-
Notifications
You must be signed in to change notification settings - Fork 14
Transition pynio to cfgrib for wgrib2 engine. #263
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
christinaholtNOAA
wants to merge
91
commits into
main
Choose a base branch
from
cfgrib
base: main
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 all commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
781957f
Pkg by pkg
christinaholtNOAA cc75b2c
Adding cfgrib entries to default_specs.yml
christinaholtNOAA 6626b01
A few more cfgrib entries.
christinaholtNOAA b954aa0
Best effort with RRFS pressure level file.
christinaholtNOAA cea64b5
Can plot t2m field.
christinaholtNOAA 9698269
Tested all graphics that show up on web for RRFS.
christinaholtNOAA 51e962f
All complete. Working through diffs in graphics.
christinaholtNOAA 24069a6
Matching all RRFS/HRRR graphics.
christinaholtNOAA 413b5b1
Adding some tooling for testing.
christinaholtNOAA 30b6cb4
Formatting existing code.
christinaholtNOAA fdc0624
Executable.
christinaholtNOAA f87eb13
Partially done formatting and linting.
christinaholtNOAA df1da6d
Fully linted.
christinaholtNOAA 48617df
WIP with mypy.
christinaholtNOAA ffc321a
WIP with mypy
christinaholtNOAA 717686a
mypy done!
christinaholtNOAA 85fe1f9
Passing all tests that still exist.
christinaholtNOAA fbc8ba1
Conversions fully tested.
christinaholtNOAA ef756c1
specs.py tested.
christinaholtNOAA 5b52c34
Simplified and unittested gribfile.py
christinaholtNOAA c5b4b30
WIP testing gribdata
christinaholtNOAA da861e4
WIP testing gribdata
christinaholtNOAA 145ba3e
WIP finished uppdata class.
christinaholtNOAA 3daa75f
WIP testings gribdata
christinaholtNOAA 6f75a5c
gribdata tested!
christinaholtNOAA d364554
Figure_builders tested.
christinaholtNOAA 9d5647d
Probably should add the tests.
christinaholtNOAA c691a64
WIP for utils tests.
christinaholtNOAA f5b9676
utils tested.
christinaholtNOAA dc58711
Runs graphics the same again.
christinaholtNOAA 2dbc2a5
Cleanup data and add environment management.
christinaholtNOAA 0fc45a8
Passing all tests.
christinaholtNOAA 87608c9
Configure Git LFS for tracking data files.
christinaholtNOAA 4471c0c
Updates needed for portability.
christinaholtNOAA e26fe2b
All HRRR AK images completed.
christinaholtNOAA cfcb4ec
Generalize forecast lead times in default specs.
christinaholtNOAA 33d21e1
Fix wind barbs.
christinaholtNOAA 0152ca9
WIP RAP.
christinaholtNOAA 487cad3
Works for SkewTs.
christinaholtNOAA eecbeab
Passing tests.
christinaholtNOAA d9eca5b
All current tests passing.
christinaholtNOAA f945a6b
Speedup unittests to ~1 min.
christinaholtNOAA 6a89ede
Tests and maps pass. SkewTs need some speed work.
christinaholtNOAA e8523a1
Okay, NOW the tests pass.
christinaholtNOAA 6a2dbcb
30s skewts.
christinaholtNOAA 22c301e
Remove errant pylint directives.
christinaholtNOAA af7c49e
Open file into single datastructure.
christinaholtNOAA f1b4204
Open the file only once for most cases.
christinaholtNOAA 78a0ca7
Merge branch 'cfgrib' of https://github.com/NOAA-GSL/pygraf into cfgrib
christinaholtNOAA 4a3d789
small fixes
christinaholtNOAA ca93e25
Merge remote-tracking branch 'origin/main' into cfgrib
christinaholtNOAA deac2bc
Changes needed from self review.
christinaholtNOAA fdef24d
Need to install the dev packages.
christinaholtNOAA 1c9b054
Activate mamba?
christinaholtNOAA 0eda1c8
Try again.
christinaholtNOAA cf13c58
Try again
christinaholtNOAA c6243c5
Try again
christinaholtNOAA 3be841f
Let's try miniforge
christinaholtNOAA 590fc82
Miniforge worked! Activate env and use for hrrr tests
christinaholtNOAA 2825512
Refine test filtering.
christinaholtNOAA e457778
Run this test with more procs and fewer lead times.
christinaholtNOAA b95a7b7
Verbose
christinaholtNOAA b6e6bb7
MORE verbose
christinaholtNOAA 7689e6e
Try again.
christinaholtNOAA f12506a
Only one map.
christinaholtNOAA e97c5a3
Changes discussed in person at review.
christinaholtNOAA dc75054
Updating to newest python solvable.
christinaholtNOAA c5eb8c3
Pin miniforge version.
christinaholtNOAA 6dc0421
Ignore future warnings from cfgrib.
christinaholtNOAA 1f5a94b
Update the pattern for str | None = "default".
christinaholtNOAA 8352b46
_kwargs instead of noqa.
christinaholtNOAA 81d809d
Suggested changes from pr.
christinaholtNOAA 5baea8b
One more parent.
christinaholtNOAA bf0a2a5
Apply suggestions from code review
christinaholtNOAA bb9dc75
Apply suggested reduction of suppressors.
christinaholtNOAA e36d4f0
Merge branch 'cfgrib' of https://github.com/NOAA-GSL/pygraf into cfgrib
christinaholtNOAA 233f946
Updating numeric_level to use regex.
christinaholtNOAA 776ba87
Use native zipfile instead of subprocess.
christinaholtNOAA 85fc4a3
More suggested changes.
christinaholtNOAA 7466dfd
Apply suggestions from code review
christinaholtNOAA 1f30829
pragma: no cover with 100% coverage requirement.
christinaholtNOAA 6400807
Merge branch 'cfgrib' of https://github.com/NOAA-GSL/pygraf into cfgrib
christinaholtNOAA f6dd1f5
A few changes I missed on GH.
christinaholtNOAA 2946044
Renaming.
christinaholtNOAA 0e9cf27
A few more coverage statements.
christinaholtNOAA 593ab17
Missed one more block.
christinaholtNOAA 2083ce8
Add backend args for open_datasets.
christinaholtNOAA 5f8c287
WIP Debugging CAR and HI runs.
christinaholtNOAA 6335b16
Testing with all.
christinaholtNOAA ccdd977
Lint and test.
christinaholtNOAA fed4606
Adding support for regional mpas.
christinaholtNOAA 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,3 @@ | ||
| tests/data/wrfnat_hrconus_16.grib2 filter=lfs diff=lfs merge=lfs -text | ||
| tests/data/wrfprs_hrconus_16.grib2 filter=lfs diff=lfs merge=lfs -text | ||
| tests/data/wrf* filter=lfs diff=lfs merge=lfs -text |
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
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
| TARGETS = devenv env format lint test typecheck unittest | ||
| DEVPKGS = $(shell cat devpkgs) | ||
| ENVNAME = pygraf | ||
|
|
||
| .PHONY: $(TARGETS) | ||
|
|
||
|
|
||
| devenv: env | ||
| mamba install -y -n $(ENVNAME) $(DEVPKGS) | ||
|
|
||
| env: | ||
| mamba env create -y -f environment.yml | ||
|
|
||
| format: | ||
| @./format | ||
|
|
||
| lint: | ||
| ruff check . | ||
|
|
||
| test: lint typecheck unittest | ||
|
|
||
| typecheck: | ||
| mypy --install-types --non-interactive . | ||
|
|
||
| unittest: | ||
| pytest --cov -k "not hrrr_maps" -n 4 . | ||
|
|
||
| memtest: | ||
| pytest --memray -k "not hrrr" . | ||
|
|
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
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 |
|---|---|---|
| @@ -1,109 +1,109 @@ | ||
| # pylint: disable=unused-argument,invalid-name | ||
| ''' | ||
| """ | ||
| This module contains functions for converting the units of a field. The | ||
| interface requires a single atmospheric field in a Numpy array, and returns the | ||
| converted values as output. | ||
| ''' | ||
| """ | ||
|
|
||
| import numpy as np | ||
| from numpy import ndarray | ||
| from xarray import DataArray | ||
| from xarray.ufuncs import sqrt, square | ||
|
|
||
| def k_to_c(field, **kwargs): | ||
|
|
||
| ''' Conversion from Kelvin to Celsius ''' | ||
| def k_to_c(field: ndarray, **_kwargs): | ||
| """Conversion from Kelvin to Celsius.""" | ||
|
|
||
| return field - 273.15 | ||
|
|
||
| def k_to_f(field, **kwargs): | ||
|
|
||
| ''' Conversion from Kelvin to Farenheit ''' | ||
| def k_to_f(field: ndarray, **_kwargs): | ||
| """Conversion from Kelvin to Fahrenheit.""" | ||
| return (field - 273.15) * 9 / 5 + 32 | ||
|
|
||
| return (field - 273.15) * 9/5 + 32 | ||
|
|
||
| def kgm2_to_in(field, **kwargs): | ||
|
|
||
| ''' Conversion from kg per m^2 to inches ''' | ||
| def kgm2_to_in(field: ndarray, **_kwargs): | ||
| """Conversion from kg per m^2 to inches.""" | ||
|
|
||
| return field * 0.03937 | ||
|
|
||
| def magnitude(a, b, **kwargs): | ||
|
|
||
| ''' Return the magnitude of vector components ''' | ||
| def magnitude(a: DataArray, b: DataArray, **_kwargs) -> DataArray: | ||
| """Return the magnitude of vector components.""" | ||
|
|
||
| return np.sqrt(np.square(a) + np.square(b)) | ||
| return DataArray(sqrt(square(a) + square(b))) | ||
|
|
||
| def m_to_dm(field, **kwargs): | ||
|
|
||
| ''' Conversion from meters to decameters ''' | ||
| def m_to_dm(field: ndarray, **_kwargs): | ||
| """Conversion from meters to decameters.""" | ||
|
|
||
| return field / 10. | ||
| return field / 10.0 | ||
|
|
||
| def m_to_in(field, **kwargs): | ||
|
|
||
| ''' Conversion from meters to inches ''' | ||
| def m_to_in(field: ndarray, **_kwargs): | ||
| """Conversion from meters to inches.""" | ||
|
|
||
| return field * 39.3701 | ||
|
|
||
| def m_to_kft(field, **kwargs): | ||
|
|
||
| ''' Conversion from meters to kilofeet ''' | ||
| def m_to_kft(field: ndarray, **_kwargs): | ||
| """Conversion from meters to kilofeet.""" | ||
|
|
||
| return field / 304.8 | ||
|
|
||
| def m_to_mi(field, **kwargs): | ||
|
|
||
| ''' Conversion from meters to miles ''' | ||
| def m_to_mi(field: ndarray, **_kwargs): | ||
| """Conversion from meters to miles.""" | ||
| return field / 1609.344 | ||
|
|
||
| def ms_to_kt(field, **kwargs): | ||
|
|
||
| ''' Conversion from m s-1 to knots ''' | ||
| def ms_to_kt(field: ndarray, **_kwargs): | ||
| """Conversion from m s-1 to knots.""" | ||
christinaholtNOAA marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return field * 1.9438 | ||
|
|
||
| def pa_to_hpa(field, **kwargs): | ||
|
|
||
| ''' Conversion from Pascals to hectopascals ''' | ||
| def pa_to_hpa(field: ndarray, **_kwargs): | ||
| """Conversion from Pascals to hectopascals.""" | ||
|
|
||
| return field / 100. | ||
| return field / 100.0 | ||
|
|
||
| def percent(field, **kwargs): | ||
|
|
||
| ''' Conversion from values between 0 - 1 to percent ''' | ||
| def percent(field: ndarray, **_kwargs): | ||
| """Conversion from values between 0 - 1 to percent.""" | ||
|
|
||
| return field * 100. | ||
| return field * 100.0 | ||
|
|
||
| def to_micro(field, **kwargs): | ||
|
|
||
| ''' Convert field to micro ''' | ||
| def sden_to_slr(field: ndarray, **_kwargs): | ||
| """Convert snow density (kg m-3) to snow-liquid ratio.""" | ||
|
|
||
| return field * 1E6 | ||
| return 1000.0 / field | ||
|
|
||
| def to_micrograms_per_m3(field, **kwargs): | ||
|
|
||
| ''' Convert field to micrograms per cubic meter ''' | ||
| def to_micro(field: ndarray, **_kwargs): | ||
| """Convert field to micro.""" | ||
|
|
||
| return field * 1E9 | ||
| return field * 1e6 | ||
|
|
||
| def vvel_scale(field, **kwargs): | ||
|
|
||
| ''' Scale vertical velocity for plotting ''' | ||
| def to_micrograms_per_m3(field: ndarray, **_kwargs): | ||
| """Convert field to micrograms per cubic meter.""" | ||
|
|
||
| return field * -10 | ||
| return field * 1e9 | ||
|
|
||
| def vort_scale(field, **kwargs): | ||
|
|
||
| ''' Scale vorticity for plotting ''' | ||
| def vvel_scale(field: ndarray, **_kwargs): | ||
| """Scale vertical velocity for plotting.""" | ||
|
|
||
| return field / 1E-05 | ||
| return field * -10 | ||
|
|
||
| def weasd_to_1hsnw(field, **kwargs): | ||
|
|
||
| ''' Conversion from snow wter equiv to snow (10:1 ratio) ''' | ||
| def vort_scale(field: ndarray, **_kwargs): | ||
| """Scale vorticity for plotting.""" | ||
|
|
||
| return field * 10. | ||
| return field / 1e-05 | ||
|
|
||
| def sden_to_slr(field, **kwargs): | ||
|
|
||
| ''' Convert snow density (kg m-3) to snow-liquid ratio ''' | ||
| def weasd_to_1hsnw(field: ndarray, **_kwargs): | ||
| """Conversion from snow water equiv to snow (10:1 ratio).""" | ||
|
|
||
| return 1000. / field | ||
| return field * 10.0 | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no significant changes here, only those related to typing, formatting, and linting.