rigoudyg / climaf

CliMAF - a Climate Model Analysis Framework - doc at : http://climaf.readthedocs.org/
Other
16 stars 7 forks source link

explore('choices') should list all its results in the same order #210

Open jypeter opened 3 years ago

jypeter commented 3 years ago

I thought that if I had several realizations with different periods, explore('choices') would list the periods and the realizations in the same order, but it does not seem to be the case. See example below

It's possible that there is nothing to do about this, or that I should check what results I get with the grouping options. Also, in the case below, the different realizations have non overlapping periods, but what would happen it the periods were the same, or if there was an overlap

>>> pprint.pprint(ds(project='CMIP6', experiment='piControl', model='GISS-E2-1-G', variable='pr', table='Amon', period='*').explore('choices'))
{'grid': 'gn',
 'institute': 'NASA-GISS',
 'mip': 'CMIP',
 'period': [2900-2999, 4150-5000, 7550-7894],
 'realization': ['r1i1p1f1', 'r1i1p1f2', 'r1i1p1f3']}

>>> ds(project='CMIP6', experiment='piControl', model='GISS-E2-1-G', variable='pr', table='Amon',
realization='r1i1p1f1', period='*').explore('resolve').crs
"ds('CMIP6%%pr%4150-5000%global%/bdd%GISS-E2-1-G%NASA-GISS%CMIP%Amon%piControl%r1i1p1f1%gn%latest')"

>>> ds(project='CMIP6', experiment='piControl', model='GISS-E2-1-G', variable='pr', table='Amon',
realization='r1i1p1f2', period='*').explore('resolve').crs
"ds('CMIP6%%pr%7550-7894%global%/bdd%GISS-E2-1-G%NASA-GISS%CMIP%Amon%piControl%r1i1p1f2%gn%latest')"

>>> ds(project='CMIP6', experiment='piControl', model='GISS-E2-1-G', variable='pr', table='Amon',
realization='r1i1p1f3', period='*').explore('resolve').crs
"ds('CMIP6%%pr%2900-2999%global%/bdd%GISS-E2-1-G%NASA-GISS%CMIP%Amon%piControl%r1i1p1f3%gn%latest')"
senesis commented 2 years ago

The current design of method explore (and underlying code) doesn't allow to keep track of which realization corresponds to which period. New dataset's method glob, as introduced in #215, allows to retrieve a list of dictionaries representing each matching case (and with all keys/facets or only the key/facets which vary among cases)