COSIMA / cosima-cookbook

Framework for indexing and querying ocean-sea ice model output.
https://cosima-recipes.readthedocs.io/en/latest/
Apache License 2.0
58 stars 25 forks source link

Assign proper (2D) lat-lon coords with `getvar` #336

Open navidcy opened 8 months ago

navidcy commented 8 months ago

The variables don't have the unmasked 2D lat-lon coordinates so after we load a variable

var = cosima_cookbook.querying.getvar(experiment, variable, session, frequency='1 monthly', n=-1)

we need to do something like

geolon_t = cosima_cookbook.querying.getvar(experiment, 'geolon_t', session, n=-1)
geolat_t = cosima_cookbook.querying.getvar(experiment, 'geolat_t', session, n=-1)

var = var.assign_coords({'geolon_t': geolon_t, 'geolat_t': geolat_t})

to be able to plot properly; see https://cosima-recipes.readthedocs.io/en/latest/Tutorials/Making_Maps_with_Cartopy.html#Fixing-the-tripole

Why don't we modify the cosima_cookbook.querying.getvar method to load and assign the coords before returning back the dataarray/dataset?

anton-seaice commented 8 months ago

This is similar to https://github.com/ACCESS-NRI/access-nri-intake-catalog/issues/112 for the intake catalog.