-
Notifications
You must be signed in to change notification settings - Fork 60
National Water Model HDFReference Recipe #215
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
Open
norlandrhagen
wants to merge
4
commits into
pangeo-forge:master
Choose a base branch
from
norlandrhagen:national-water-model
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| title: 'E-OBS dataset' | ||
| description: The National Water Model dataset is a produced by the National Oceanic and Atmospheric Administations (NOAA) Office of Water Prediction. It is a forecast model of water resources, providing multiple variables across the Continental United States (CONUS). This dataset is available via the Registry of Open Data on AWS as a collection of netCDF files that do not require any login authentication. This Pangeo-Forge recipe uses the HDFReferenceRecipe, which leverages kerchunk and fsspec_reference_maker to build an index so that this dataset can be read as if it were a ARCO dataset. | ||
| pangeo_forge_version: '0.9.0' | ||
| pangeo_notebook_version: '2022.06.02' | ||
| recipes: | ||
| - id: NWM | ||
| object: 'recipe:recipe' | ||
| provenance: | ||
| providers: | ||
| - name: 'National Oceanic and Atmospheric Administration (NOAA) Office of Water Prediction' | ||
| description: 'NOAA National Water Model CONUS Retrospective Dataset was accessed on 11-01-2022 from https://registry.opendata.aws/nwm-archive.' | ||
| roles: | ||
| - producer | ||
| - licensor | ||
| url: https://water.noaa.gov/about/nwm | ||
| license: Open | ||
andersy005 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| maintainers: | ||
| - name: 'Raphael Hagen' | ||
| orcid: '0000-0003-1994-1153' | ||
| github: norlandrhagen | ||
| bakery: | ||
| id: 'pangeo-ldeo-nsf-earthcube' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Author: Norland Raphael Hagen @norlandrhagen 11-01-2022 | ||
| # Pangeo-Forge recipe for National Water Model - Short Range Forecast # noqa: E501 | ||
| # Heavily adapted from Kerchunk example written by Rich Signell (USGS) @rsignell-usgs. https://gist.github.com/rsignell-usgs/ef435a53ac530a2843ce7e1d59f96e22 # noqa: E501 | ||
|
|
||
| import os | ||
|
|
||
| import fsspec | ||
|
|
||
| from pangeo_forge_recipes.patterns import pattern_from_file_sequence | ||
| from pangeo_forge_recipes.recipes.reference_hdf_zarr import HDFReferenceRecipe | ||
|
|
||
| # Create fsspec aws filesystem | ||
| fs = fsspec.filesystem('s3', anon=True, skip_instance_cache=True) | ||
| flist = fs.glob('noaa-nwm-pds/nwm.*/short_range/nwm.*.short_range.channel_rt.f001.conus.nc') | ||
|
|
||
| # Join the "best time series" from past forecasts with the latest forecast | ||
| # Remove the first day of data since this is a rolling collection and | ||
| # we don't want to be trying to access files that soon will be removed. | ||
| # & Use all the files from the last forecast cycle | ||
|
|
||
| last_dir = f'{os.path.dirname(flist[-1])}' | ||
| last_file = os.path.basename(flist[-1]).split('.') | ||
| last_files = fs.glob( | ||
| f'{last_dir}/{last_file[0]}.{last_file[1]}.{last_file[2]}.channel_rt.*.conus.nc' | ||
| ) | ||
|
|
||
| # Skip the first of the last_files since it's a duplicate | ||
| flist.extend(last_files[1:]) | ||
|
|
||
| # Append s3 prefix | ||
| urls = ['s3://' + f for f in flist] | ||
|
|
||
| # Create filepattern from urls | ||
| pattern = pattern_from_file_sequence(urls, 'time') | ||
|
|
||
| # Create HDFReference recipe from pattern | ||
| recipe = HDFReferenceRecipe(pattern, netcdf_storage_options={'anon': True}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.