In [6]:
from ARCCSSive import CMIP5

In [7]:
db=CMIP5.connect()

Pass to the session "outputs" method some arguments to search for data


In [9]:
results = db.outputs(experiment='historical',mip='day')

The "outputs" method returns the corresponding rows from the Instance table as result. We use the count() method to check how many Instances we got back


In [10]:
results.count()


Out[10]:
2734

NB the search is very fast no matter how many rows we get back or how many fields we use as arguments. This is because we are not actually accessing the instance objects yet.


In [11]:
results = db.outputs(experiment='rcp45',model='CNRM-CM5',mip='Amon',variable='tas', ensemble='r1i1p1')
results.count()


Out[11]:
1

We loop through the result object to find out the available versions and other Instance fields


In [12]:
for o in results:
    print("Available versions for ensemble " + str(o.ensemble))
    print("")
    for v in o.versions: 
        print(str(v.version) + " from " + str(v.path))
        print("")
    print("drstree path is " + str(o.drstree_path()))


Available versions for ensemble r1i1p1

v20111006 from /g/data/ua6/unofficial-ESG-replica/tmp/tree/pcmdi9.llnl.gov/thredds/fileServer/cmip5_data/cmip5/output1/CNRM-CERFACS/CNRM-CM5/rcp45/mon/atmos/Amon/r1i1p1/tas/1

v20111006 from /g/data/ua6/unofficial-ESG-replica/tmp/tree/esg.cnrm-game-meteo.fr/thredds/fileServer/esg_dataroot1/CMIP5/output/CNRM-CERFACS/CNRM-CM5/rcp45/mon/atmos/tas/r1i1p1

v20111006 from /g/data/ua6/unofficial-ESG-replica/tmp/tree/esg.cnrm-game-meteo.fr/thredds/fileServer/esg_dataroot1/CMIP5/output1/CNRM-CERFACS/CNRM-CM5/rcp45/mon/atmos/Amon/r1i1p1/v20111006/tas

drstree path is /g/data1/r87/DRSv2/CMIP5/CNRM-CM5/rcp45/mon/atmos/r1i1p1/tas/latest

Another search this time without specifying the model


In [13]:
results = db.outputs(experiment='rcp45',mip='Amon',variable='clt')
results.count()


Out[13]:
106

Which models?


In [14]:
models=set()

In [15]:
for o in results:
    models.add(str(o.model))

In [16]:
print(sorted(models))


['ACCESS1-0', 'ACCESS1-3', 'BNU-ESM', 'CCSM4', 'CMCC-CM', 'CMCC-CMS', 'CNRM-CM5', 'CSIRO-Mk3-6-0', 'CSIRO-Mk3L-1-2', 'CanESM2', 'EC-EARTH', 'FGOALS-g2', 'FIO-ESM', 'GFDL-CM3', 'GFDL-ESM2G', 'GISS-E2-H', 'GISS-E2-H-CC', 'GISS-E2-R', 'GISS-E2-R-CC', 'HadCM3', 'HadGEM2-AO', 'HadGEM2-CC', 'HadGEM2-ES', 'IPSL-CM5A-LR', 'IPSL-CM5A-MR', 'IPSL-CM5B-LR', 'MIROC-ESM', 'MIROC-ESM-CHEM', 'MIROC4h', 'MIROC5', 'MPI-ESM-LR', 'MPI-ESM-MR', 'MRI-CGCM3', 'NorESM1-M', 'inmcm4']

In [18]:
from ARCCSSive.CMIP5.Model import Instance, Version

In [19]:
new_results=results.filter(Instance.model=='MIROC5').filter(Version.path.contains("/data1"))

In [20]:
for o in new_results:
    for v in o.versions:
        print(v.version,"is latest? ",v.is_latest,"last checked on",v.checked_on)
        print("")
        if v==o.latest()[0]:
            print("Latest available version on raijin is")
            print("")
            print(v.path)
            print("")
            print(v.filenames())
            print("")
            f=v.files[0]
            print(f.filename,f.tracking_id)
            print("")


(u'v20111202', 'is latest? ', False, 'last checked on', u'15/04/2016')

(u'v20120710', 'is latest? ', None, 'last checked on', None)

Latest available version on raijin is

/g/data/ua6/unofficial-ESG-replica/tmp/tree/aims3.llnl.gov/thredds/fileServer/cmip5_css02_data/cmip5/output1/MIROC/MIROC5/rcp45/mon/atmos/Amon/r3i1p1/clt/1

[u'clt_Amon_MIROC5_rcp45_r3i1p1_200601-210012.nc']

(u'clt_Amon_MIROC5_rcp45_r3i1p1_200601-210012.nc', u'5fb250da-24ac-4d8f-87f7-9d629a78a049')

(u'v20110801', 'is latest? ', False, 'last checked on', u'15/04/2016')

(u'v20120710', 'is latest? ', None, 'last checked on', None)

Latest available version on raijin is

/g/data/ua6/unofficial-ESG-replica/tmp/tree/aims3.llnl.gov/thredds/fileServer/cmip5_css02_data/cmip5/output1/MIROC/MIROC5/rcp45/mon/atmos/Amon/r1i1p1/clt/1

[u'clt_Amon_MIROC5_rcp45_r1i1p1_200601-210012.nc']

(u'clt_Amon_MIROC5_rcp45_r1i1p1_200601-210012.nc', u'52e0391e-d08f-4f05-9b05-aea803b277d7')

(u'v20120710', 'is latest? ', None, 'last checked on', None)

Latest available version on raijin is

/g/data/ua6/unofficial-ESG-replica/tmp/tree/aims3.llnl.gov/thredds/fileServer/cmip5_css02_data/cmip5/output1/MIROC/MIROC5/rcp45/mon/atmos/Amon/r2i1p1/clt/1

[u'clt_Amon_MIROC5_rcp45_r2i1p1_200601-210012.nc']

(u'clt_Amon_MIROC5_rcp45_r2i1p1_200601-210012.nc', u'0495b62b-6394-45d6-a1d6-6fd44c529115')


In [ ]: