Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: initial AQS support #249

Merged
merged 11 commits into from
May 1, 2024
Merged

CLI: initial AQS support #249

merged 11 commits into from
May 1, 2024

Conversation

zmoon
Copy link
Collaborator

@zmoon zmoon commented Feb 13, 2024

Some things in monetio are not working currently, like network selection and other aspects involving the separate metadata. But getting hourly and daily data seem to be working ok here.

zmoon added 7 commits July 17, 2023 15:20
Testing with

melodies-monet get-aqs -s 2022-07-20 -e 2022-07-23 --verbose -p VOC --debug
seems like there are some extra times, e.g. on minute 19
maybe should resample
OpenSSL v3 should work fine now, since AQS updated their
web server
"By default, the hourly data is fetched."
)
),
param: List[str] = typer.Option(["SPEC", "PM2.5", "PM10", "VOC"], "-p", "--params", help=(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rschwant @bbakernoaa what do you think defaults should be?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rschwant suggested default could be O3, PM2.5, PM10

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree. I'm testing this out right now too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in e54849f , with some additional help text.

@rschwant
Copy link
Collaborator

@zmoon, how would you use this code to download the daily data? I tried this:
melodies-monet get-aqs -s 2021-01-01 -e 2021-01-03 --daily but I get this error:
Fetching data with monetio failed in 146 seconds
Error message: 'time'

@zmoon
Copy link
Collaborator Author

zmoon commented Feb 29, 2024

@rschwant The daily option currently needs a fix from the monetio side. Did you try without --daily?

@rschwant
Copy link
Collaborator

Yes, without daily works, but I want to try to pull the daily averaged data from IMPROVE.

@zmoon
Copy link
Collaborator Author

zmoon commented Feb 29, 2024

Ok, I can do a monetio hotfix for it.

@zmoon
Copy link
Collaborator Author

zmoon commented Mar 1, 2024

CI failure is related to the NCDC website the ISH files are on failing. Update: working again

with my fix/aqs branch of monetio
@zmoon
Copy link
Collaborator Author

zmoon commented Mar 11, 2024

@rschwant daily option should be working with this branch of monetio: noaa-oar-arl/monetio#163 I'll also comment here when it has been released via conda-forge (hopefully soon).

@rschwant
Copy link
Collaborator

The daily option works with your updates now. Thanks for updating. Would it be possible to extend the default meta data to include some additional options for both daily and non-daily include the following: method_code, method_name, networks, monitor_type, measurement_scale, measurement_scale_definition, land_use, & epa_region. People may want to filter and group on these options in the future.

@zmoon
Copy link
Collaborator Author

zmoon commented Mar 14, 2024

@rschwant method code and name are available without the AQS metadata loading, but not currently usable, since the long-to-wide format transformation doesn't (currently) create separate columns for them for each parameter, so currently I am skipping them:

# Variables associated with a measurement,

The others will come from the AQS metadata files, once that is fixed.

So, in the future, after more monetio work, we should be able to get all of those that you mentioned. But we might as well get this PR in first, since it at least gets the data.

However, I could add land-use now though, since I am already loading the sites metadata file in order to get UTC offset, and that is included. So is state name, so I could assign EPA region from that.

>>> list(pd.read_csv("https://aqs.epa.gov/aqsweb/airdata/aqs_sites.zip"))
['State Code',
 'County Code',
 'Site Number',
 'Latitude',
 'Longitude',
 'Datum',
 'Elevation',
 'Land Use',
 'Location Setting',
 'Site Established Date',
 'Site Closed Date',
 'Met Site State Code',
 'Met Site County Code',
 'Met Site Site Number',
 'Met Site Type',
 'Met Site Distance',
 'Met Site Direction',
 'GMT Offset',
 'Owning Agency',
 'Local Site Name',
 'Address',
 'Zip Code',
 'State Name',
 'County Name',
 'City Name',
 'CBSA Name',
 'Tribe Name',
 'Extraction Date']

@rschwant
Copy link
Collaborator

Sounds we can add this later then. Let me know when this is ready to go in then and I can approve.

melodies_monet/_cli.py Outdated Show resolved Hide resolved
@zmoon zmoon marked this pull request as ready for review April 22, 2024 19:23
@zmoon
Copy link
Collaborator Author

zmoon commented Apr 30, 2024

@rschwant final look?

Copy link
Collaborator

@rschwant rschwant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I approve!

@zmoon zmoon merged commit ebf7c7b into NOAA-CSL:develop May 1, 2024
4 checks passed
@zmoon zmoon deleted the cli-aqs branch May 1, 2024 15:56
@zmoon zmoon mentioned this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants