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

Variable not found #324

Open ashjbarnes opened 1 year ago

ashjbarnes commented 1 year ago

Trying to access fields 'u' and 'v' from 01deg_jra55v13_ryf9091. cc.explore.DatabaseExplorer finds says that they exist, gives me the query to try and then running the query says the variable wasn't found

cc.querying.getvar(expt='01deg_jra55v13_ryf9091', variable='v', 
                          session=session, frequency='1 daily',
                          attrs={'cell_methods': 'time: mean'})

image

angus-g commented 1 year ago

The query you posted and the one you ran are different: where you got the error you have a date constraint. Are you sure that's valid for the data, and not falling outside the interval where that variable exists?

ashjbarnes commented 1 year ago

Yeah I ran both with and without date constraint. Without the date constraint (i.e, asking for all the dates) gave the same error

angus-g commented 1 year ago

I'm not able to reproduce this; asking for the full segment gets me

ValueError: Resulting object does not have monotonic global indexes along dimension time

As noted by Ellie on the Hive. Has the cookbook worked for you for other variables? Are all your storage flags, etc. set up correctly?

ashjbarnes commented 1 year ago

I'm able to access the data in the notebook via xr.open_dataset just fine, and when querying the variables cookbook gives them to me (u and v are listed below)

image

Trying to get average_DT gives the same error.

I'm pretty new to using the cookbook. I've just been following the tutorial notebook

image

I also tried fiddling with the start and end times with no luck

angus-g commented 1 year ago

As mentioned from the linked post:

In the RYF run, the model description says daily data is only available for 1 Jan 1950 to 31 Dec 1969 and 1 Jan 2086 to 31 Dec 2100

For me, I can get some of the data from the valid period:

>>> cc.querying.getvar('01deg_jra55v13_ryf9091', 'v', s, frequency='1 daily', attrs={'cell_methods': 'time: mean'}, start_time='2086', end_time='2087')
<xarray.DataArray 'v' (time: 365, st_ocean: 75, yu_ocean: 2700, xu_ocean: 3600)>
dask.array<concatenate, shape=(365, 75, 2700, 3600), dtype=float32, chunksize=(1, 7, 300, 400), chunktype=numpy.ndarray>
...

In the get_variables output, average_DT doesn't have any cell_methods, so your query for that is too specific. In general, you probably don't even need to filter by attributes unless you're running into an ambiguous query. Also, the following line should've thrown an error since it's an incorrect call to getvar():

data = cc.querying.getvar(session, experiment='01deg_jra55v13', frequency='1 daily')

I think it might be clearer if you produce and upload a notebook that demonstrates exactly what you're trying, in order from top to bottom, to narrow down any possible mistakes.