[ecco-support] [EXTERNAL] Mapping to Lat-Lon
Fenty, Ian G (US 329C)
ian.fenty at jpl.nasa.gov
Sat Jul 18 03:43:57 EDT 2020
Deb,
I can't give you any help with the xgcm. We do have a (growing) library of tutorials describing how to use the ecco-v4-py library to work with ECCOv4 Release 3 and Release 4. The tutorials describe the ECCOv4 netCDF fields, the grid and grid coordinate system, different plotting tools, and provide code examples for a number of different calculations. While ecco-v4-py does *use* xgcm for some backend stuff, I've never used their LLCMapper. Our "plot_proj_to_latlon_grid" routine probably does something similar.
For plotting help see the tutorial "Plotting Tiles": https://ecco-v4-python-tutorial.readthedocs.io/ECCO_v4_Plotting_Tiles.html <https://ecco-v4-python-tutorial.readthedocs.io/ECCO_v4_Plotting_Tiles.html#>
Your email reminded me that I had a new tutorial 90% written about how to interpolate scalar and vector fields from the ECCOv4 llc90 grid to regular lat-lon grids. I finished it and it is now online here:
https://ecco-v4-python-tutorial.readthedocs.io/ECCO_v4_Interpolating_Fields_to_Lat-Lon_Grid.html
I would not advise you to *start* with that tutorial, however. Later chapters build on earlier ones.
Ian
________________________________
From: ecco-support-bounces at mit.edu <ecco-support-bounces at mit.edu> on behalf of Deb Gardner <dagardne at ucsd.edu>
Sent: Thursday, July 16, 2020 1:13:19 PM
To: ecco-support at mit.edu
Subject: [EXTERNAL] [ecco-support] Mapping to Lat-Lon
Good day, colleagues,
I have hit a roadblock. I'm attempting to plot zonal and depth-integrated v4r4 variables as a function of latitude. I'm using the xgcm python package and jupyter notebook. I did find LLCMapper and have attempted to use that information to create something that will work for my needs. My problems are
1) 'faces' are called 'tile' in v4r4 variables
2) I'm getting the error that I must have 'i' coordinate (I have 'i_g', perhaps shift to 'i'?)
3) I'm not entirely sure LLCMapper is going to allow me to do what I eventually want to do.
Would someone mind taking a look at my code below and giving feedback/suggestions? Thanks in advance!
Warm regards,
Deb Gardner (she/her/ella)
NSF Graduate Research Fellow
Best Waffle Topping, 2019 | Scripps Institution of Oceanography
SIO Graduate Student Council, Junior Co-Chair 2020-2021
--
I respectfully acknowledge that UC San Diego and its surrounding communities occupy the stolen territory of the Kumeyaay/Kumiai Nation and to whom I owe honor and gratitude. / Whose land are you on?
<https://native-land.ca/>
# calculate pressure gradient in x-dir
dP = gcm_grid.derivative(P,'X',boundary='extend')
# zonal and depth integral of pressure gradient in x
dP_int = gcm_grid.integrate(dP,['Z','X'])
# dP coords - k, tile, j, i_g
# zonal integration of windstress
taue_int = gcm_grid.cumsum(oceTAUE,'X',boundary='extend')
# note: grid.integrate does not work with oceTAUE
#taue_int has coordinates tile, j, i_g
Pmapper = LLCMapper(P_coords)
tauemapper = LLCMapper(taue_coords)
#calling either of the mappers with the integrated values produces the same error (below)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-34-1562da53e232> in <module>
----> 1 Pmapper(dP_int)
<ipython-input-8-efce9e1da44c> in __call__(self, da, ax, projection, lon_0, **plt_kwargs)
14 self.new_grid = pyresample.geometry.GridDefinition(lons=self.new_grid_lon,lats=self.new_grid_lat)
15 def __call__(self, da, ax=None, projection=cart.crs.Robinson(), lon_0=-60, **plt_kwargs):
---> 16 assert set(da.dims) == set(['face', 'j', 'i']), "da must have dimensions ['face', 'j', 'i']"
17 if ax is None:
18 fig, ax = plt.subplots(figsize=(12, 6))
AssertionError: da must have dimensions ['face', 'j', 'i']
<https://native-land.ca/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/ecco-support/attachments/20200718/45850c22/attachment.html
More information about the ecco-support
mailing list