wiki:udg/ecoms/dataserver/interfaces/matlab

Version 9 (modified by rodri, 9 years ago) (diff)

--

Function:

As for Phyton, a Matlab function (loadSystem4.m) has been created in order to access the hindcast of the System4 stored in the SPECS-EUPORIAS Data Portal in a user-friendly way. This would be a typical call to the function:

 [data,run,ens,frc,lat,lon] = loadSystem4(dataset,var,season,leadMonth,varargin);

Obligatory input arguments:

  • dataset: A string indicating the url of the dataset to be read (check the catalog of available datasets here).
  • var: A string indicating the variable to be read.
  • season: A cell of two strings indicating the first and final months to be read. Single months ({'Jan';'Jan'}) or seasons defined by consecutive months ({'Dec';'Feb'}) can be specified. Note that months are denoted by their three first letters.
  • leadMonth: Forecast lead time (in months) to be considered. For instance, leadMonth = 1 for January refers to forecasts issued the first of December.

Optional input arguments (varargin):

  • members: Vector indicating the members to consider. By default all available members are considered.
  • xlim: Vector of length = 2 with minimum and maximum longitude (in degrees) of the selected bounding box. By default the whole domain of the dataset is considered.
  • ylim: Vector of length = 2 with minimum and maximum latitude (in degrees) of the selected bounding box. By default the whole domain of the dataset is considered.
  • user: Username for ccessing the OPeNPAD server. By default it is set to 'euporias'.
  • password: Password for accessing the OPeNPAD server. By default it is set to 'uc123'.

Outputs returned by the function:

  • data: Cell with n = number of years 5-D matrices. Each matrix contains the forecasts for a particular year. Its first and second dimension of the matrix refers to the dataset and variable read. The third dimension correspondons to the forecasts times. Forth and fifth dimensions refer to the latitudes and longitudes of the grid boxes selected.
  • run: Cell with n = number of years vectors. Each vector indicates the initialization time (in datevec format) for a particular year.
  • ens: Cell of n = number of years vectors. Each vector contains the ensemble members considered.
  • frc: Cell with n = number of years 2-D matrices. Each matrix contains the forecasts times (in datevec format) for a particular year.
  • lat: Cell of n = number of years vectors. Each vector contains the latitudes of the selected domain.
  • lon: Cell of n = number of years vectors. Each vector contains the longitudes of the selected domain.

Example:

In this example, the loadSystem4 function is used to read the maximum temperature for the Iberian Peninsula in August for the whole hindcast period (1981-2010), considering the initialization of the first of June (two-month lead time thus) for a single member (member5, for instance).

dataset = 'http://www.meteo.unican.es/tds5/dodsC/system4/System4_Seasonal_15Members.ncml';
var = 'Maximum_temperature_at_2_metres_since_last_24_hours_surface';
[data,run,ens,frc,lat,lon] = loadSystem4(dataset,var,{'Aug';'Aug'},2,'members',5,'xlim',[-10 5],'ylim',[35 45]);

The data can be plotted by using the functions from MeteoLab, the open-source Matlab toolbox for statistical analysis and data mining in Meteorology created by the Santander Meteorology Group.

lon = lon{1};
lat = lat{1};
[nx,ny] = meshgrid(lon,lat);
nod = [nx(:)';ny(:)']';

datay1 = nan(1,size(nod,1));
for ilat = 1:length(lat)
    inod = find(ismember(nod,[lon,repmat(lat(ilat),length(lon),1)],'rows') == 1);
    datay1(:,inod) = nanmean(squeeze(data{1}(1,1,:,ilat,:)) - 273.15);
end

drawStationsValue(datay1,nod,'marker','t','size',0.75,'colorbar','true','clim',[20 40],'resolution','high')
colormap(jet)
title('System4: Mean Maximum Temperature (ºC) in August')

Attachments (1)

Download all attachments as: .zip