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

Surface velocities from ECCO data portal #307

Open
cspencerjones opened this issue Jun 24, 2022 · 2 comments
Open

Surface velocities from ECCO data portal #307

cspencerjones opened this issue Jun 24, 2022 · 2 comments

Comments

@cspencerjones
Copy link
Contributor

For a future project, I wanted to use surface velocities from the ECCO data portal (to avoid egress charges). They are available as part of the regional data released here. The data is "shrunk" so it probably makes sense to use existing llcreader code to unshrink it.

I downloaded a single time slice of SSU and SSV and so far my code looks like this:

from xmitgcm import llcreader
from fsspec.implementations.local import LocalFileSystem
fs = LocalFileSystem()
store = llcreader.BaseStore(fs, base_path='/swot/SUM01/spencer/LLCsurf')
model = llcreader.LLC4320Model(store)
ds_faces = model.get_dataset(varnames=['SSU'])

However, xmitgcm isn't aware that SSU is a possible variable name, so I get an error:

KeyError                                  Traceback (most recent call last)
<ipython-input-7-86109449e317> in <module>
----> 1 ds_faces = model.get_dataset(varnames=['SSU'])

~/.conda/envs/pangeo1/lib/python3.9/site-packages/xmitgcm/llcreader/llcmodel.py in get_dataset(self, varnames, iter_start, iter_stop, iter_step, iters, k_levels, k_chunksize, type, read_grid, grid_vars_to_coords)
    897 
    898         # get the data in facet form
--> 899         data_facets = {vname:
    900                        self._get_facet_data(vname, iters, k_levels, k_chunksize)
    901                        for vname in varnames}

~/.conda/envs/pangeo1/lib/python3.9/site-packages/xmitgcm/llcreader/llcmodel.py in <dictcomp>(.0)
    898         # get the data in facet form
    899         data_facets = {vname:
--> 900                        self._get_facet_data(vname, iters, k_levels, k_chunksize)
    901                        for vname in varnames}
    902 

~/.conda/envs/pangeo1/lib/python3.9/site-packages/xmitgcm/llcreader/llcmodel.py in _get_facet_data(self, varname, iters, klevels, k_chunksize)
    741     def _get_facet_data(self, varname, iters, klevels, k_chunksize):
    742         # needs facets to be outer index of nested lists
--> 743         dims = _VAR_METADATA[varname]['dims']
    744 
    745         if len(dims)==2:

KeyError: 'SSU'

Would I need to add SSU, SSV etc. to the package as variable names in order to open this data? Or is there something deeper I am missing here?

(this issue is related to #253 I think)

cc @dhruvbalwada

@timothyas
Copy link
Member

Hey @cspencerjones! Does it work to specify your own inherited llc model on the fly, e.g. like

from xmitgcm import llcreader

class SurfaceLLC4320Model(llcreader.LLC4320Model):
    varnames = ["SSU", "SSV"]

If it's truly a regional setup without the 13 faces, then other attributes like nface may have to change, and it could get hairy (I'm not totally sure ...)

@rabernat
Copy link
Member

I would recommend browsing through the known models code and trying to find a template to modify.

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

No branches or pull requests

3 participants