ESGF DAP Access

Earth System Grid Federation data requires users to log in to get access to the data. Here is how you would access ESGF data using OPeNDAP. Note that not all files are exposed through the OPeNDAP protocol…

[1]:
import os
import xarray as xr
from pydap.cas.esgf import setup_session
# ds_url = "http://esgfcog.cccma.ec.gc.ca/thredds/dodsC/cmip5.output.CCCma.CanESM2.rcp85.mon.atmos.r4i1p1.pr.20130331.aggregation"
# The CCCMA server fails with an SSLError...
# ds_url = "https://esgf1.dkrz.de/thredds/dodsC/cmip5.output1.MPI-M.MPI-ESM-MR.rcp85.day.atmos.day.r1i1p1.uas.20120503.aggregation"
ds_url = "https://esgf1.dkrz.de/thredds/dodsC/cmip5.output1.MPI-M.MPI-ESM-MR.rcp85.mon.atmos.Amon.r1i1p1.pr.20120503.aggregation"
username = os.environ.get('ESGF_AUTH_USERNAME', '<your openid>')
password = os.environ.get('ESGF_AUTH_PASSWORD', '<password>')
session = setup_session(username, password, check_url=ds_url, verify=True)
store = xr.backends.PydapDataStore.open(ds_url, session=session)
ds = xr.open_dataset(store, decode_cf=False)
ds.attrs
[1]:
{'institution': 'Max Planck Institute for Meteorology',
 'institute_id': 'MPI-M',
 'experiment_id': 'rcp85',
 'source': 'MPI-ESM-MR 2011; URL: http://svn.zmaw.de/svn/cosmos/branches/releases/mpi-esm-cmip5/src/mod; atmosphere: ECHAM6 (REV: 4936), T63L47; land: JSBACH (REV: 4936); ocean: MPIOM (REV: 4936), GR15L40; sea ice: 4936; marine bgc: HAMOCC (REV: 4936);',
 'model_id': 'MPI-ESM-MR',
 'forcing': 'GHG,Oz,SD,Sl,Vl,LU',
 'parent_experiment_id': 'historical',
 'parent_experiment_rip': 'r1i1p1',
 'branch_time': 56978.0,
 'contact': 'cmip5-mpi-esm@dkrz.de',
 'history': 'Model raw output postprocessing with modelling environment (IMDI) at DKRZ: URL: http://svn-mad.zmaw.de/svn/mad/Model/IMDI/trunk, REV: 3998 2011-11-14T17:28:06Z CMOR rewrote data to comply with CF standards and CMIP5 requirements.',
 'references': 'ECHAM6: n/a; JSBACH: Raddatz et al., 2007. Will the tropical land biosphere dominate the climate-carbon cycle feedback during the twenty first century? Climate Dynamics, 29, 565-574, doi 10.1007/s00382-007-0247-8;  MPIOM: Marsland et al., 2003. The Max-Planck-Institute global ocean/sea ice model with orthogonal curvilinear coordinates. Ocean Modelling, 5, 91-127;  HAMOCC: Technical Documentation, http://www.mpimet.mpg.de/fileadmin/models/MPIOM/HAMOCC5.1_TECHNICAL_REPORT.pdf;',
 'initialization_method': 1,
 'physics_version': 1,
 'tracking_id': '87fa3a10-89ff-453e-b230-8c29b76bea9e',
 'product': 'output',
 'experiment': 'RCP8.5',
 'frequency': 'mon',
 'creation_date': '2011-11-14T17:28:06Z',
 'Conventions': 'CF-1.4',
 'project_id': 'CMIP5',
 'table_id': 'Table Amon (27 April 2011) a5a1c518f52ae340313ba0aada03f862',
 'title': 'MPI-ESM-MR model output prepared for CMIP5 RCP8.5',
 'parent_experiment': 'historical',
 'modeling_realm': 'atmos',
 'realization': 1,
 'cmor_version': '2.6.0'}