derived

Rslice can also operate on a derived ROMS variable, i.e. one that is not actually present in the ROMS file. In this case, rslice requires grid information to be supplied along with the derived variable. Care must also be taken to give the input data the proper dimensions, as ROMS will be making guesses about the data based on the dimension sizes. For example, if the derived data presented to rslice has three dimensions, then rslice will assume that it has been given a timeseries of 2D slices of YX data. If the derived data has four dimensions, then the assumption is that it is a time series of ZYX data.

The input argument should be a structure with two fields then provide it as 4D in order to two fields:

roms_grid

This field should be retrieved from a suitable grid file via roms_get_grid.m.

vardata

This is the data to be visualized using rslice.

Example 4.9. Providing Derived Temperature As Input to Rslice

This example retrieve temperature from a ROMS file, converts it to fahrenheight, and feeds it into rslice. As can be seen, there are 10 timesteps. Since the data is already 4D, rslice is ready to work with it.

>> ncfile = '/p/jevans/dods-data/roms/nena/run4/avg/2004_Jan_avg.nc';
>> d.roms_grid = roms_get_grid ( ncfile, [5 0.4 50 30] );
>> [temp, status] = nc_varget ( ncfile, 'temp' );
>> size(temp)

ans =

    10    30   130   386

>> d.vardata = temp *9/5 + 32;    % convert to Fahrenheight
>> rslice ( 'derived', d );

                


Example 4.10. Providing 2D SSH As Input to Rslice

In this example, the data is 2D sea surface height. However, rslice expects the input to be a time series, even if that time series is only a single snapshot.

>> ncfile = '/p/jevans/dods-data/roms/nena/run4/avg/2004_Jan_avg.nc';
>> d.roms_grid = roms_get_grid ( ncfile, [5 0.4 50 30] );
>> [ssh, status] = nc_varget ( ncfile, 'zeta', [0 0 0], [1 -1 -1] );  % get the first ssh time instance only
>> size(ssh)

ans =

    130   386

>> ssh_ft = ssh * 3.28084;    % convert to feet
>> d.vardata(1,:,) = ssh_ft;  % force the input to be seen as 3D (time in the first slot)
>> rslice ( 'derived', d );