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

Derivatives & map factors #2743

Merged
merged 83 commits into from
Dec 23, 2022
Merged
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
9473dfd
Mockup/draft implementation of using a projection-correct vector deri…
jthielen Nov 20, 2021
391a7c2
Minimum commit for vorticity+xarray testing
dcamron Oct 17, 2022
e17c2db
Provide some test drafts and fixtures
dcamron Oct 17, 2022
7c4ada2
Improve agreement with GEMPAK
dopplershift Oct 19, 2022
7fc8ae8
Fix logic error determining when to calculate factors
dopplershift Nov 10, 2022
14dd8c3
Fix generation of scale arrays to produce DataArrays
dopplershift Nov 10, 2022
4550661
Update test values for new computation
dopplershift Nov 10, 2022
c3b8bc5
Refactor eliminate the need for unused function arguments
dopplershift Nov 21, 2022
5d616d5
Adjust sign in correction
dopplershift Nov 22, 2022
538bc6f
Consolidate check on dimensions
dopplershift Nov 22, 2022
fc59a21
Add test for vorticity on geographic grid
dopplershift Nov 22, 2022
080341e
Dynamically update function signature and docstrings
dopplershift Nov 23, 2022
0e7781c
Fix up divergence test and add another
dopplershift Nov 23, 2022
5da1800
Update deformation calculations using _vector_derivative
dopplershift Nov 23, 2022
cdca1a9
Remove unused GFS global dataset fixture
dopplershift Nov 23, 2022
8ae745d
Clean up some flake8 warnings
dopplershift Nov 23, 2022
dbab1ff
Update absolute_vorticity for proper vector derivative handling
dopplershift Nov 30, 2022
e7bd0a1
Fix up some ordering in function docstrings
dopplershift Nov 30, 2022
f8f9890
Make sure all newly added function arguments are kw-only
dopplershift Nov 30, 2022
e22b8a8
Remove unneeded comment
dopplershift Nov 30, 2022
cac5334
Remove unneeded test fixtures
dopplershift Nov 30, 2022
0940bee
Fix spelling
dopplershift Nov 30, 2022
b55ba9d
Fix up lat/lon handling to allow proper xarray broadcasting
dopplershift Nov 30, 2022
8b28b9b
Fix numpy handling broken by previous commit
dopplershift Nov 30, 2022
848d4b7
Add geospatial gradient
dcamron Nov 30, 2022
75529ff
Update frontogenesis for spatial calc
dcamron Dec 1, 2022
21de52c
Update q_vector for spatial calc
dcamron Dec 1, 2022
5b71230
Update geostrophic_wind for spatial calc
dcamron Dec 1, 2022
36ae749
Update ageostrophic_wind for spatial
dcamron Dec 1, 2022
648ddbd
Update advection for spatial calc
dcamron Dec 1, 2022
38389dd
Add z-x "cross-sections" test for advection
dcamron Dec 1, 2022
83a364e
Update inertial_advective_wind for spatial calc
dcamron Dec 1, 2022
9fdba53
Update baroclinic pv for spatial calc
dcamron Dec 1, 2022
f11000d
Add spatial+4d test for baroclinic pv
dcamron Dec 1, 2022
1b9924e
Remove unused gradient import
dcamron Dec 1, 2022
4d267b6
Fix grid coordinates for non-lat/lon case
dopplershift Dec 2, 2022
b0fabed
Fix up coordinate assignment for p and m scale arrays
dopplershift Dec 2, 2022
d8488dd
Clean up
dopplershift Dec 2, 2022
0b2ffb6
Remove new-style type hint
dopplershift Dec 2, 2022
4ea11af
DOC: Add parallel/meridional scales to docstrings
dopplershift Dec 2, 2022
b0dace8
Update potential_vorticity_barotropic for new derivatives
dopplershift Dec 2, 2022
d2d71ab
Remove unused import of add_grid_arguments_from_xarray
dopplershift Dec 2, 2022
094ced1
Add vector_derivative and geospatial gradient to func table
dopplershift Dec 2, 2022
50bd892
Docstring improvements
dopplershift Dec 5, 2022
58e775a
Add parametrized geospatial_gradient test
dcamron Dec 5, 2022
c2d5623
Simplify casting scale to xarray
dopplershift Dec 6, 2022
7cc5c12
Assume a lat/lon PyPROJ CRS for 1D lat/lon coords
dopplershift Dec 6, 2022
8a770ae
Assume a CRS for 1D lat/lon when finding dx/dy
dopplershift Dec 6, 2022
5c58496
Add test for projected deltas at pole
dcamron Dec 6, 2022
bf78ebd
Update error message
dopplershift Dec 6, 2022
e9cd4b6
Fix reference to pyproj.crs.CRS
dopplershift Dec 6, 2022
358e0ee
Fix up some docstring errors
dopplershift Dec 7, 2022
129d7e8
Update test values based on new implementation
dopplershift Dec 7, 2022
a55bc8e
Bump minimum PyPROJ to 2.6 for get_factors()
dopplershift Dec 7, 2022
12908f6
Fix u-first behavior of geospatial_gradient
dcamron Dec 7, 2022
0bcc445
Fix up absolute_vorticity docstring
dopplershift Dec 7, 2022
041e0a6
Reduce code duplication using a fixture
dopplershift Dec 7, 2022
49a9376
Move geog_data fixture to conftest
dopplershift Dec 7, 2022
3323cd1
Bump PyProj minimum to 2.6.1
dopplershift Dec 7, 2022
306101f
Update see also
dcamron Dec 7, 2022
4288e7a
Flatten vector_derivative output
dcamron Dec 7, 2022
03cdccd
Add preprocessing decorators
dcamron Dec 7, 2022
bf1ae26
Add geospatial_laplacian
dcamron Dec 7, 2022
34aca8a
Simplify test to use fixture arrays
dcamron Dec 7, 2022
a61224e
Add test for geospatial_laplacian
dcamron Dec 7, 2022
3b125ce
Add geospatial_laplacian to doc table
dcamron Dec 7, 2022
c869409
Collapse _vector_derivative to public function
dcamron Dec 7, 2022
043775d
Remove add_grid_arguments_from_xarray
dopplershift Dec 12, 2022
2c13191
Add some more tests for nominal_lat_lon_grid_deltas
dopplershift Dec 13, 2022
e735fde
Expand testing for parse_grid_arguments
dopplershift Dec 13, 2022
a348461
Add test for parse_grid_arguments with unknown coordinates
dopplershift Dec 13, 2022
6b9b7aa
Remove unused line from test
dopplershift Dec 13, 2022
3741258
Use correct wrapping syntax
dcamron Dec 13, 2022
0c839c9
Add test for geospatial_gradient return_only
dcamron Dec 13, 2022
a585e4a
Add test for vector_derivative return_only
dcamron Dec 13, 2022
287b942
Expand test docstring placeholder
dcamron Dec 13, 2022
e31427a
Add test for unknown dimensions
dopplershift Dec 13, 2022
de5872e
Add xarray vertical advection test
dcamron Dec 13, 2022
79b258a
Remove unnecessary dict construction
dcamron Dec 20, 2022
f4bbd69
Rename units in vertical advection test
dcamron Dec 20, 2022
74c6008
Add advection escape in dz parsing
dcamron Dec 20, 2022
55e0132
Test 1-d vertical advection with xarray
dcamron Dec 20, 2022
f963218
Fix test for minimum xarray
dcamron Dec 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix generation of scale arrays to produce DataArrays
This allows making them broadcast to be compatible with the original
data.
dopplershift committed Dec 23, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 14dd8c3c1d3ec00fbbd3144d07856fc4119ce29e
8 changes: 6 additions & 2 deletions src/metpy/calc/tools.py
Original file line number Diff line number Diff line change
@@ -1163,8 +1163,12 @@ def wrapper(*args, **kwargs):
else:
raise ValueError('Latitude and longitude must be either 1D or 2D.')
factors = proj.get_factors(xx, yy)
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
bound_args.arguments['parallel_scale'] = factors.parallel_scale
bound_args.arguments['meridional_scale'] = factors.meridional_scale
coords = list(grid_prototype.metpy.coordinates('latitude', 'longitude'))
bound_args.arguments['parallel_scale'] = xr.DataArray(
factors.parallel_scale, coords=coords).broadcast_like(
grid_prototype)
bound_args.arguments['meridional_scale'] = xr.DataArray(
factors.meridional_scale, coords=coords).broadcast_like(grid_prototype)


# # Fill in latitude