# Changes between Version 15 and Version 16 of udg/ecoms/dataserver/interfaces/python

Ignore:
Timestamp:
Feb 24, 2014 1:05:57 PM (8 years ago)
Comment:

--

### Legend:

Unmodified
 v15 A python function has been created in order to access the ''SPECS-EUPORIAS Data Portal'' in a user-friendly way, allowing the retrieval of dimensional slices of selected simulation members from the ECMWF's SYSTEM4 model. This function ([browser:software/specseuporias/dataserver/python/load_system4.py load_system4.py]) automatically cares about the proper location of the right indices for data sub-setting across the different variable dimensions, given a few simple arguments for subset definition. In addition, instead of retrieving a NetCDF file that needs to be opened and read, the requested data is directly loaded into the current python working session, according to a particular structure described below, prior to data analysis and/or representation. The request is simply formulated via the load_system4 function: The request is simply formulated via the loadSystem4 function: {{{ >>> load_system4(dataset, var, season, leadMonth, lonLim, latLim, year, members=[]) >>> loadSystem4(dataset, var, season, leadMonth, lonlim, latlim, year, members=[]) }}} * members: List of members to select. In the above case, a single member (the first) of the System4 ensemble is loaded, but additional members could be also specified  (e.g. members=[0,1,2,3,4] for the first five members). * lonLim: Vector of length = 2, with minimum and maximum longitude coordinates, in decimal degrees, of the bounding box selected. * latLim: Vector of length = 2, with minimum and maximum latitude coordinates, in decimal degrees, of the bounding box selected. * lonlim: Vector of length = 2, with minimum and maximum longitude coordinates, in decimal degrees, of the bounding box selected. * latlim: Vector of length = 2, with minimum and maximum latitude coordinates, in decimal degrees, of the bounding box selected. * season: A vector of integers specifying the desired season (in months, January=1, etc.) of analysis. Options include a single month (as in the above example) or a standard season (e.g. season = [12,1,2] for standard Boreal winter, DJF). * year: List of years to select. Note that in cases with year-crossing seasons (e.g. winter DJF, season = [12,1,2], for a particular year period year = [1981,1982,1983]), by convention the first season would be DJF 1981/82. >>> password = "myPassword" >>> dataset = "http://%s:%s@www.meteo.unican.es/tds5/dodsC/system4/System4_Seasonal_15Members.ncml" %(username,password) >>> ud = loadSystem4(dataset,var,season, leadMonth,lonlim, latlim, year, members=[0]) >>> uds = loadSystem4(dataset,var,season, leadMonth,lonlim, latlim, year, members=[0])  # Note that this function returns a list >>> ud=deepcopy(uds[0]) >>> ud.data = np.mean(map(lambda x:x.data, uds),axis=0)   # The ensemble mean, in case we select more than one member }}}