roms_matlab plotting and analysis routines
roms_matlab plotting and analysis routines
The documentation is at http://romsmatlab.tiddlyspot.com and the codes are managed using svn.
The {z,s,i,j}view.m routines make simple plots directly from a ROMS file or OPeNDAP URL by slicing along coordinate directions.
For example:
>> url='http://server/thredds/dodsC/roms/cblast ... 0/averages'
>> g=roms_get_grid(url,url); % the grid structure
>> % temperature slice for time step nearest to 20JUN2002, at 2-m
>> % depth, with every 3rd velocity vector over-plotted
>> roms_zview(url,'temp','20-Jun-2002',-2,g,3,.1,'k')
The *slice.m routines extract a slice through a 3- or 4-D ROMS data chunk that is already in the workspace (such as some diagnostic quantity you might have computed that is not present in an output file directly).
roms_get_grid produces a Matlab structure to facilitate passing the coordinate information to all the functions.
roms_zint performs a vertical integral of a 3-D ROMS quantity over the full water depth, between prescribed z-levels, or between iso-surfaces.
Several of these functions were created or improved with the assistance of Gordon Zhang, John Evans and other members of the Rutgers Ocean Modeling Group. The netcdf file reading is via John Evans' snctools functions.
This announcement does not represent a commitment to a high level of online support (!), but I thought it was time I shared these files more widely. There are a number of deeply embedded hacks and 'features' that I have created for my own analysis. Rather than remove them for distribution, they have been left in the code to confuse you.
This is a work in progress. If you find these tools useful, constructive comments on improvements are always appreciated.
John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Thanks for these very good tools.
I'm able to use some of then, but with some options the program complain about specific functions or sub-functions.
For example:
Using:
roms_zview('ocean_his.nc','umag',1,1,grd)
I get:
??? Undefined function or method 'av2' for input arguments of type 'double'
It happens because I don't have the "av2" function.
I have the same problem when the program calls the function "change":
can you help me to get these functions working?
many thanks
Carlos Teixeira
The changes are made to the svn archive so update and let me know if the functions is choking on any other calls.
John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I tried to follow the wilkins documentation mentioend in http://romsmatlab.tiddlyspot.com but still the process is not clear how to visualize the roms output. In terms of visualization, is scripts avaiable in tools under matlab is somehow required?...anyway confused.
pls anyone help me
Rouf
Re: roms_matlab plotting and analysis routines
>> file = 'ocean_his.nc'
>> g=roms_get_grid(file,file); % the grid structure
>> % temperature slice for first time step in the history file
>> % at depth 5 meters, with every 3rd velocity vector over-plotted
>> % Try a velocity vector scale factor of 0.1
>> s = 0.1;
>> roms_zview(file,'temp',1,-5,g,3,s,'k')
>> help roms_zview
and the documentation at http://romsmatlab.tiddlyspot.com explains how the options to these routines work.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Yes I added your matlab tools and set to my matlab path. Tried to follow instructions but showing following errors
Code: Select all
>> file = 'ocean_his.nc'
file =
ocean_his.nc
>> g=roms_get_grid(file,file); % the grid structure
Warning: Variable not found: lon_rho
> In roms_get_grid at 58
Warning: Variable not found: lat_rho
> In roms_get_grid at 58
Warning: Variable not found: mask_rho
> In roms_get_grid at 58
Warning: Variable not found: angle
> In roms_get_grid at 58
Warning: Variable not found: h
> In roms_get_grid at 58
Warning: Variable not found: pm
> In roms_get_grid at 58
Warning: Variable not found: pn
> In roms_get_grid at 58
Warning: Variable not found: lon_rho
> In roms_get_grid at 58
Warning: Variable not found: lat_rho
> In roms_get_grid at 58
Warning: Variable not found: mask_rho
> In roms_get_grid at 58
Warning: Variable not found: lon_psi
> In roms_get_grid at 58
Warning: Variable not found: lat_psi
> In roms_get_grid at 58
Warning: Variable not found: mask_psi
> In roms_get_grid at 58
Warning: Variable not found: lon_v
> In roms_get_grid at 58
Warning: Variable not found: lat_v
> In roms_get_grid at 58
Warning: Variable not found: mask_v
> In roms_get_grid at 58
Warning: Variable not found: lon_u
> In roms_get_grid at 58
Warning: Variable not found: lat_u
> In roms_get_grid at 58
Warning: Variable not found: mask_u
> In roms_get_grid at 58
Warning: Variable not found: f
> In roms_get_grid at 58
[color=#FF0000]??? Error using ==> snctools\private\snc_error
No such file or directory
Error in ==> nc_isvar>nc_isvar_mexnc at 57
snc_error ( 'SNCTOOLS:NC_ISVAR:MEXNC:OPEN', ncerr );
Error in ==> nc_isvar at 40
bool = nc_isvar_mexnc ( ncfile, varname );
Error in ==> roms_get_grid at 63
if nc_isvar(grd_file,'x_rho')[/color]
Rouf
Re: roms_matlab plotting and analysis routines
(ROMS does not actually need lon/lat to run, only the grid metric factors pm,pn which are the reciprocal of the grid spacing.)
I wrote my matlab plotting code assuming the grid lat/lon (lon_rho, lat_rho, lon_u, lat_u etc) would be the spatial coordinates. So since these aren't available in this case I have amended roms_get_grid to substitute the x/y coordinates in the grid structure. I have checked in the new version to the svn repository at https://www.myroms.org/svn/om/matlab/roms_wilkin
so please run an "svn update" and see if this fixes your problem. I tested it on UPWELLING example output and it works.
John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Thanks. There are little improvement after update but still the following errors
Code: Select all
>> file = 'ocean_his.nc'
file =
ocean_his.nc
>> g=roms_get_grid(file,file); % the grid structure
Warning: Variable not found: mask_rho
> In roms_get_grid at 57
Warning: Variable not found: mask_psi
> In roms_get_grid at 57
Warning: Variable not found: mask_u
> In roms_get_grid at 57
Warning: Variable not found: mask_v
> In roms_get_grid at 57
Warning: Variable not found: angle
> In roms_get_grid at 57
Warning: Variable not found: h
> In roms_get_grid at 57
Warning: Variable not found: pm
> In roms_get_grid at 57
Warning: Variable not found: pn
> In roms_get_grid at 57
Warning: Variable not found: f
> In roms_get_grid at 57
??? Error using ==> snctools\private\snc_error
No such file or directory
Error in ==> nc_isvar>nc_isvar_mexnc at 57
snc_error ( 'SNCTOOLS:NC_ISVAR:MEXNC:OPEN', ncerr );
Error in ==> nc_isvar at 40
bool = nc_isvar_mexnc ( ncfile, varname );
Error in ==> roms_get_grid at 62
if nc_isvar(grd_file,'x_rho')
Rouf
Re: roms_matlab plotting and analysis routines
John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I understand the problem you noticed regarding my errors. I ensured ocean_his.nc is in right path and got following error.
Code: Select all
>> file = 'ocean_his.nc'
file =
ocean_his.nc
>> g=roms_get_grid(file,file);
Warning: Variable not found: mask_rho
> In roms_get_grid at 57
Warning: Variable not found: mask_psi
> In roms_get_grid at 57
Warning: Variable not found: mask_u
> In roms_get_grid at 57
Warning: Variable not found: mask_v
> In roms_get_grid at 57
Warning: Variable not found: angle
> In roms_get_grid at 57
Warning: lon_rho not found. Substituting x/y coords instead
> In roms_get_grid at 83
Warning: lat_rho not found. Substituting x/y coords instead
> In roms_get_grid at 83
Warning: lon_psi not found. Substituting x/y coords instead
> In roms_get_grid at 83
Warning: lat_psi not found. Substituting x/y coords instead
> In roms_get_grid at 83
Warning: lon_v not found. Substituting x/y coords instead
> In roms_get_grid at 83
Warning: lat_v not found. Substituting x/y coords instead
> In roms_get_grid at 83
Warning: lon_u not found. Substituting x/y coords instead
> In roms_get_grid at 83
Warning: lat_u not found. Substituting x/y coords instead
> In roms_get_grid at 83
>> roms_zview(file,'temp',1,-5,g,3,s,'k')
??? Reference to non-existent field 'mask_u'.
Error in ==> roms_zslice_var at 44
mask = grd.mask_u;
Error in ==> roms_zslice at 64
[data,x,y] = roms_zslice_var(data,1,depth,grd);
Error in ==> roms_zview at 217
u = roms_zslice(file,'u',time,depth,grd);
Code: Select all
>> url='http://server/thredds/dodsC/roms/cblast/2002-050/averages'
url =
http://server/thredds/dodsC/roms/cblast/2002-050/averages
>> g=roms_get_grid(url,url);
Warning: Variable not found: mask_rho
> In roms_get_grid at 57
Warning: Variable not found: mask_psi
> In roms_get_grid at 57
Warning: Variable not found: mask_u
> In roms_get_grid at 57
Warning: Variable not found: mask_v
> In roms_get_grid at 57
Warning: Variable not found: angle
> In roms_get_grid at 57
Warning: Variable not found: h
> In roms_get_grid at 57
Warning: Variable not found: pm
> In roms_get_grid at 57
Warning: Variable not found: pn
> In roms_get_grid at 57
Warning: Variable not found: f
> In roms_get_grid at 57
Rouf
Re: roms_matlab plotting and analysis routines
Code: Select all
>> url='http://server/thredds/dodsC/roms/cblast/2002-050/averages'
Does your application using MASKING? If not, the output won't include the masks. This is why roms_get_grid only gives warnings in the absence of masks.
Do you have an input grid file (GRDNAME in ocean.in)? If so, try loading this. If your grid is specified in ana_grid, then you need to be sure you are writing the grid to the output. At the unix prompt use e.g. 'ncdump', or in Matlab use e.g. nc_dump, to see the contents of your ocean_his.nc
i.e. in Matlab:
Code: Select all
>> nc_dump('ocean_his.nc')
Code: Select all
#define NO_WRITE_GRID
John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I understand your explanation regarding url.
I am using the upwelling test case. Yes, there is no information regarding masking in the ocean_his.nc file so I hope thats why roms_get_grid only gives warnings regarding masks as u mentioned.
ocean_his.nc in matlab showing the following content
Code: Select all
:ana_file = "ROMS/Functionals/ana_btflux.h, ROMS/Functionals/ana_grid.h, ROMS/Functionals/ana_initial.h, ROMS/Functionals/ana_smflux.h, ROMS/Functionals/ana_stflux.h, ROMS/Functionals/ana_vmix.h"
:CPP_options = "UPWELLING, ANA_BSFLUX, ANA_BTFLUX, ANA_GRID, ANA_INITIAL, ANA_SMFLUX, ANA_SSFLUX, ANA_STFLUX, ANA_VMIX, AVERAGES, DIAGNOSTICS_TS, DIAGNOSTICS_UV, DJ_GRADPS, DOUBLE_PRECISION, EW_PERIODIC, MIX_S_TS, MIX_S_UV, NONLINEAR, !NONLIN_EOS, POWER_LAW, PROFILE, !RST_SINGLE, SALINITY, SOLVE3D, SPLINES, TS_U3HADVECTION, TS_C4VADVECTION, TS_DIF2, UV_ADV, UV_COR, UV_U3HADVECTION, UV_C4VADVECTION, UV_LDRAG, UV_VIS2, VAR_RHO_2D,"
If your grid is specified in ana_grid, then you need to be sure you are writing the grid to the output.
Anyway, even with the masking error i continued to follow your prescribed commands
Code: Select all
>> file = 'ocean_his.nc'
>> g=roms_get_grid(file,file); % the grid structure
>> s = 0.1;
>> roms_zview(file,'temp',1,-5,g,3,s,'k')
Rouf
Re: roms_matlab plotting and analysis routines
Code: Select all
>> roms_zview(file,'temp',1,-5,g,3,0.1,'k')
??? Reference to non-existent field 'mask_u'.
Error in ==> roms_zslice_var at 44
mask = grd.mask_u;
Error in ==> roms_zslice at 64
[data,x,y] = roms_zslice_var(data,1,depth,grd);
Error in ==> roms_zview at 217
u = roms_zslice(file,'u',time,depth,grd);
Rouf
Re: roms_matlab plotting and analysis routines
From your last message it is hard to tell what success, if any, you are having. You say
Please show me what figure you get. (Use the upload attachment panel to include it in your posting.)There is a output figure, but seems not the actual output figure.
Your last error message (I am pleased to see they are progressing) suggests using the option to plot velocity vectors is now seeking masks at u,v points that are unavailable. So I have further modified roms_get_grid to create null masks for all of u,v,psi in the case there is no mask information in the grid or output file.
I'd like to return to one other of your comments:
ROMS can't be doing both, so which is it? Are you giving grid information by a netcdf grid file (via input GRDNAME in ocean.in), or are you using ana_grid.h . The standard out (logfile) tells you which ROMS is using. (Just because GRDNAME is set in ocean.in does not mean ROMS is using that, so please answer accurately).So I can say input grid file is in the .in file and grid is specified in ana_grid.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Please find the attached file. In terms of running upwelling test case in ROMS, I didn’t modify anything except following running ROMS under the tutorial installing ROMS in windows XP via Cygwin. I am not sure about the term standard out (logfile), but I check the upwellingout.dat file (which I get by running ROMS). At the end of that file, it mentioned that ana_grid.h is used as Analytical header files. So I suppose ROMS use ana_grid.h here.
Looking for your comments
Rouf
- arango
- Site Admin
- Posts: 1367
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: roms_matlab plotting and analysis routines
Re: roms_matlab plotting and analysis routines
oceanS.exe < ocean.in > upwellingout.dat
Some people on the ROMS Forum refer to this output, when captured to a file, as the logfile.
Your plot looks correct, Did you make it with my roms_zview or not?
As Hernan points out, with UPWELLING you will get more informative plots if you make cross sections such as with roms_iview.m.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Rouf
- arango
- Site Admin
- Posts: 1367
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: roms_matlab plotting and analysis routines
Re: roms_matlab plotting and analysis routines
I had the same error that rouf said when i used roms_get_grid Function, I am actually new in using ROMS,
When I run these two commands:
Code: Select all
file = 'ocean_his.nc';
g=roms_get_grid(file,file);
Code: Select all
file =
ocean_his.nc
Warning: Variable not found: mask_rho
> In roms_get_grid at 57
In plot_upwelling at 3
Warning: Variable not found: mask_psi
> In roms_get_grid at 57
In plot_upwelling at 3
Warning: Variable not found: mask_u
> In roms_get_grid at 57
In plot_upwelling at 3
Warning: Variable not found: mask_v
> In roms_get_grid at 57
In plot_upwelling at 3
Warning: Variable not found: h
> In roms_get_grid at 57
In plot_upwelling at 3
Warning: Variable not found: angle
> In roms_get_grid at 57
In plot_upwelling at 3
??? Reference to non-existent field 'h'.
Error in ==> roms_get_grid at 59
grd = setfield(grd,vname,zeros(size(grd.h)));
Error in ==> plot_upwelling at 3
g=roms_get_grid(file,file); ; % the grid structure
Code: Select all
netcdf ocean_his {
dimensions:
xi_rho = 43 ;
xi_u = 42 ;
xi_v = 43 ;
xi_psi = 42 ;
eta_rho = 82 ;
eta_u = 82 ;
eta_v = 81 ;
eta_psi = 81 ;
N = 16 ;
s_rho = 16 ;
s_w = 17 ;
tracer = 2 ;
boundary = 4 ;
ocean_time = UNLIMITED ; // (21 currently)
variables:
int ntimes ;
ntimes:long_name = "number of long time-steps" ;
int ndtfast ;
ndtfast:long_name = "number of short time-steps" ;
double dt ;
dt:long_name = "size of long time-steps" ;
dt:units = "second" ;
double dtfast ;
dtfast:long_name = "size of short time-steps" ;
dtfast:units = "second" ;
double dstart ;
dstart:long_name = "time stamp assigned to model initilization" ;
dstart:units = "days since 0001-01-01 00:00:00" ;
dstart:calendar = "julian" ;
int nHIS ;
nHIS:long_name = "number of time-steps between history records" ;
int nRST ;
nRST:long_name = "number of time-steps between restart records" ;
nRST:cycle = "only latest two records are maintained" ;
int ntsAVG ;
ntsAVG:long_name = "starting time-step for accumulation of time-averaged fields" ;
int nAVG ;
nAVG:long_name = "number of time-steps between time-averaged records" ;
int ntsDIA ;
ntsDIA:long_name = "starting time-step for accumulation of diagnostic fields" ;
int nDIA ;
nDIA:long_name = "number of time-steps between diagnostic records" ;
double Falpha ;
Falpha:long_name = "Power-law shape barotropic filter parameter" ;
double Fbeta ;
Fbeta:long_name = "Power-law shape barotropic filter parameter" ;
double Fgamma ;
Fgamma:long_name = "Power-law shape barotropic filter parameter" ;
double tnu2(tracer) ;
tnu2:long_name = "Laplacian mixing coefficient for tracers" ;
tnu2:units = "meter2 second-1" ;
double visc2 ;
visc2:long_name = "Laplacian mixing coefficient for momentum" ;
visc2:units = "meter2 second-1" ;
double Akt_bak(tracer) ;
Akt_bak:long_name = "background vertical mixing coefficient for tracers" ;
Akt_bak:units = "meter2 second-1" ;
double Akv_bak ;
Akv_bak:long_name = "background vertical mixing coefficient for momentum" ;
Akv_bak:units = "meter2 second-1" ;
double rdrg ;
rdrg:long_name = "linear drag coefficient" ;
rdrg:units = "meter second-1" ;
double rdrg2 ;
rdrg2:long_name = "quadratic drag coefficient" ;
double Zob ;
Zob:long_name = "bottom roughness" ;
Zob:units = "meter" ;
double Zos ;
Zos:long_name = "surface roughness" ;
Zos:units = "meter" ;
double Znudg ;
Znudg:long_name = "free-surface nudging/relaxation inverse time scale" ;
Znudg:units = "day-1" ;
double M2nudg ;
M2nudg:long_name = "2D momentum nudging/relaxation inverse time scale" ;
M2nudg:units = "day-1" ;
double M3nudg ;
M3nudg:long_name = "3D momentum nudging/relaxation inverse time scale" ;
M3nudg:units = "day-1" ;
double Tnudg(tracer) ;
Tnudg:long_name = "Tracers nudging/relaxation inverse time scale" ;
Tnudg:units = "day-1" ;
double rho0 ;
rho0:long_name = "mean density used in Boussinesq approximation" ;
rho0:units = "kilogram meter-3" ;
double R0 ;
R0:long_name = "background density used in linear equation of state" ;
R0:units = "kilogram meter-3" ;
double Tcoef ;
Tcoef:long_name = "thermal expansion coefficient" ;
Tcoef:units = "Celsius-1" ;
double Scoef ;
Scoef:long_name = "Saline contraction coefficient" ;
Scoef:units = "PSU-1" ;
double gamma2 ;
gamma2:long_name = "slipperiness parameter" ;
char spherical ;
spherical:long_name = "grid type logical switch" ;
spherical:option_T = "spherical" ;
spherical:option_F = "Cartesian" ;
double xl ;
xl:long_name = "domain length in the XI-direction" ;
xl:units = "meter" ;
double el ;
el:long_name = "domain length in the ETA-direction" ;
el:units = "meter" ;
double theta_s ;
theta_s:long_name = "S-coordinate surface control parameter" ;
double theta_b ;
theta_b:long_name = "S-coordinate bottom control parameter" ;
double Tcline ;
Tcline:long_name = "S-coordinate surface/bottom layer width" ;
Tcline:units = "meter" ;
double hc ;
hc:long_name = "S-coordinate parameter, critical depth" ;
hc:units = "meter" ;
double s_rho(s_rho) ;
s_rho:long_name = "S-coordinate at RHO-points" ;
s_rho:valid_min = -1. ;
s_rho:valid_max = 0. ;
s_rho:standard_name = "ocean_s_coordinate" ;
s_rho:formula_terms = "s: s_rho eta: zeta depth: h a: theta_s b: theta_b depth_c: hc" ;
s_rho:field = "s_rho, scalar" ;
double s_w(s_w) ;
s_w:long_name = "S-coordinate at W-points" ;
s_w:valid_min = -1. ;
s_w:valid_max = 0. ;
s_w:standard_name = "ocean_s_coordinate" ;
s_w:formula_terms = "s: s_w eta: zeta depth: h a: theta_s b: theta_b depth_c: hc" ;
s_w:field = "s_w, scalar" ;
double Cs_r(s_rho) ;
Cs_r:long_name = "S-coordinate stretching curves at RHO-points" ;
Cs_r:valid_min = -1. ;
Cs_r:valid_max = 0. ;
Cs_r:field = "Cs_r, scalar" ;
double Cs_w(s_w) ;
Cs_w:long_name = "S-coordinate stretching curves at W-points" ;
Cs_w:valid_min = -1. ;
Cs_w:valid_max = 0. ;
Cs_w:field = "Cs_w, scalar" ;
double h(eta_rho, xi_rho) ;
h:long_name = "bathymetry at RHO-points" ;
h:units = "meter" ;
h:coordinates = "x_rho y_rho" ;
h:field = "bath, scalar" ;
double f(eta_rho, xi_rho) ;
f:long_name = "Coriolis parameter at RHO-points" ;
f:units = "second-1" ;
f:coordinates = "x_rho y_rho" ;
f:field = "coriolis, scalar" ;
double pm(eta_rho, xi_rho) ;
pm:long_name = "curvilinear coordinate metric in XI" ;
pm:units = "meter-1" ;
pm:coordinates = "x_rho y_rho" ;
pm:field = "pm, scalar" ;
double pn(eta_rho, xi_rho) ;
pn:long_name = "curvilinear coordinate metric in ETA" ;
pn:units = "meter-1" ;
pn:coordinates = "x_rho y_rho" ;
pn:field = "pn, scalar" ;
double x_rho(eta_rho, xi_rho) ;
x_rho:long_name = "x-locations of RHO-points" ;
x_rho:units = "meter" ;
x_rho:field = "x_rho, scalar" ;
double y_rho(eta_rho, xi_rho) ;
y_rho:long_name = "y-locations of RHO-points" ;
y_rho:units = "meter" ;
y_rho:field = "y_rho, scalar" ;
double x_u(eta_u, xi_u) ;
x_u:long_name = "x-locations of U-points" ;
x_u:units = "meter" ;
x_u:field = "x_u, scalar" ;
double y_u(eta_u, xi_u) ;
y_u:long_name = "y-locations of U-points" ;
y_u:units = "meter" ;
y_u:field = "y_u, scalar" ;
double x_v(eta_v, xi_v) ;
x_v:long_name = "x-locations of V-points" ;
x_v:units = "meter" ;
x_v:field = "x_v, scalar" ;
double y_v(eta_v, xi_v) ;
y_v:long_name = "y-locations of V-points" ;
y_v:units = "meter" ;
y_v:field = "y_v, scalar" ;
double x_psi(eta_psi, xi_psi) ;
x_psi:long_name = "x-locations of PSI-points" ;
x_psi:units = "meter" ;
x_psi:field = "x_psi, scalar" ;
double y_psi(eta_psi, xi_psi) ;
y_psi:long_name = "y-locations of PSI-points" ;
y_psi:units = "meter" ;
y_psi:field = "y_psi, scalar" ;
double ocean_time(ocean_time) ;
ocean_time:long_name = "time since initialization" ;
ocean_time:units = "seconds since 0001-01-01 00:00:00" ;
ocean_time:calendar = "julian" ;
ocean_time:field = "time, scalar, series" ;
float zeta(ocean_time, eta_rho, xi_rho) ;
zeta:long_name = "free-surface" ;
zeta:units = "meter" ;
zeta:time = "ocean_time" ;
zeta:coordinates = "x_rho y_rho ocean_time" ;
zeta:field = "free-surface, scalar, series" ;
float ubar(ocean_time, eta_u, xi_u) ;
ubar:long_name = "vertically integrated u-momentum component" ;
ubar:units = "meter second-1" ;
ubar:time = "ocean_time" ;
ubar:coordinates = "x_u y_u ocean_time" ;
ubar:field = "ubar-velocity, scalar, series" ;
float vbar(ocean_time, eta_v, xi_v) ;
vbar:long_name = "vertically integrated v-momentum component" ;
vbar:units = "meter second-1" ;
vbar:time = "ocean_time" ;
vbar:coordinates = "x_v y_v ocean_time" ;
vbar:field = "vbar-velocity, scalar, series" ;
float u(ocean_time, s_rho, eta_u, xi_u) ;
u:long_name = "u-momentum component" ;
u:units = "meter second-1" ;
u:time = "ocean_time" ;
u:coordinates = "x_u y_u s_rho ocean_time" ;
u:field = "u-velocity, scalar, series" ;
float v(ocean_time, s_rho, eta_v, xi_v) ;
v:long_name = "v-momentum component" ;
v:units = "meter second-1" ;
v:time = "ocean_time" ;
v:coordinates = "x_v y_v s_rho ocean_time" ;
v:field = "v-velocity, scalar, series" ;
float w(ocean_time, s_w, eta_rho, xi_rho) ;
w:long_name = "vertical momentum component" ;
w:units = "meter second-1" ;
w:time = "ocean_time" ;
w:coordinates = "x_rho y_rho s_w ocean_time" ;
w:field = "w-velocity, scalar, series" ;
float omega(ocean_time, s_w, eta_rho, xi_rho) ;
omega:long_name = "S-coordinate vertical momentum component" ;
omega:units = "meter3 second-1" ;
omega:time = "ocean_time" ;
omega:coordinates = "x_rho y_rho s_w ocean_time" ;
omega:field = "omega, scalar, series" ;
float temp(ocean_time, s_rho, eta_rho, xi_rho) ;
temp:long_name = "potential temperature" ;
temp:units = "Celsius" ;
temp:time = "ocean_time" ;
temp:coordinates = "x_rho y_rho s_rho ocean_time" ;
temp:field = "temperature, scalar, series" ;
float salt(ocean_time, s_rho, eta_rho, xi_rho) ;
salt:long_name = "salinity" ;
salt:time = "ocean_time" ;
salt:coordinates = "x_rho y_rho s_rho ocean_time" ;
salt:field = "salinity, scalar, series" ;
// global attributes:
:type = "ROMS/TOMS history file" ;
:Conventions = "CF-1.0" ;
:title = "Wind-Driven Upwelling/Downwelling over a Periodic Channel" ;
:var_info = "/sdc/roms/trunk/ROMS/External/varinfo.dat" ;
:rst_file = "ocean_rst.nc" ;
:his_file = "ocean_his.nc" ;
:avg_file = "ocean_avg.nc" ;
:dia_file = "ocean_dia.nc" ;
:svn_url = "https://www.myroms.org/svn/src/trunk" ;
:svn_rev = "r" ;
:code_dir = "/sdc/roms/trunk" ;
:header_dir = "./ROMS/Include" ;
:header_file = "upwelling.h" ;
:os = "Linux" ;
:cpu = "i686" ;
:compiler_system = "pgi" ;
:compiler_command = "pgf90" ;
:compiler_flags = " -O3 -Mfree" ;
:tiling = "001x001" ;
:history = "ROMS/TOMS, Version 3.0, Wednesday - July 9, 2008 - 10:03:58 AM" ;
:ana_file = "ROMS/Functionals/ana_btflux.h, ROMS/Functionals/ana_grid.h, ROMS/Functionals/ana_initial.h, ROMS/Functionals/ana_smflux.h,
ROMS/Functionals/ana_stflux.h, ROMS/Functionals/ana_vmix.h" ;
:CPP_options = "UPWELLING, ANA_BSFLUX, ANA_BTFLUX, ANA_GRID, ANA_INITIAL, ANA_SMFLUX, ANA_SSFLUX, ANA_STFLUX, ANA_VMIX, ASSUMED_SHAPE,
AVERAGES, DIAGNOSTICS_TS, DIAGNOSTICS_UV, DJ_GRADPS, DOUBLE_PRECISION, EW_PERIODIC, MIX_S_TS, MIX_S_UV, NONLINEAR, !NONLIN_EOS, POWER_LAW, PROFILE, !
RST_SINGLE, SALINITY, SOLVE3D, SPLINES, TS_U3HADVECTION, TS_C4VADVECTION, TS_DIF2, UV_ADV, UV_COR, UV_U3HADVECTION, UV_C4VADVECTION, UV_LDRAG, UV_VIS2,
VAR_RHO_2D," ;
Code: Select all
Process Information:
Thread # 0 (pid= 4074) is active.
Model Input Parameters: ROMS/TOMS version 3.0
Wednesday - July 9, 2008 - 10:03:58 AM
-----------------------------------------------------------------------------
Wind-Driven Upwelling/Downwelling over a Periodic Channel
Operating system : Linux
CPU/hardware : i686
Compiler system : pgi
Compiler command : pgf90
Compiler flags : -O3 -Mfree
SVN Root URL : https://www.myroms.org/svn/src/trunk
SVN Revision :
Local Root : /roms/trunk
Header Dir : ./ROMS/Include
Header file : upwelling.h
Analytical Dir: /roms/trunk/ROMS/Functionals
Resolution, Grid 01: 0041x0080x016, Parallel Threads: 1, Tiling: 001x001
Physical Parameters, Grid: 01
=============================
1440 ntimes Number of timesteps for 3-D equations.
300.000 dt Timestep size (s) for 3-D equations.
30 ndtfast Number of timesteps for 2-D equations between
each 3D timestep.
1 ERstr Starting ensemble/perturbation run number.
1 ERend Ending ensemble/perturbation run number.
0 nrrec Number of restart records to read from disk.
T LcycleRST Switch to recycle time-records in restart file.
288 nRST Number of timesteps between the writing of data
into restart fields.
1 ninfo Number of timesteps between print of information
to standard output.
T ldefout Switch to create a new output NetCDF file(s).
72 nHIS Number of timesteps between the writing fields
into history file.
1 ntsAVG Starting timestep for the accumulation of output
time-averaged data.
72 nAVG Number of timesteps between the writing of
time-averaged data into averages file.
1 ntsDIA Starting timestep for the accumulation of output
time-averaged diagnostics data.
72 nDIA Number of timesteps between the writing of
time-averaged data into diagnostics file.
0.0000E+00 tnu2(01) Horizontal, harmonic mixing coefficient (m2/s)
for tracer 01: temp
0.0000E+00 tnu2(02) Horizontal, harmonic mixing coefficient (m2/s)
for tracer 02: salt
5.0000E+00 visc2 Horizontal, harmonic mixing coefficient (m2/s)
for momentum.
1.0000E-06 Akt_bak(01) Background vertical mixing coefficient (m2/s)
for tracer 01: temp
1.0000E-06 Akt_bak(02) Background vertical mixing coefficient (m2/s)
for tracer 02: salt
1.0000E-05 Akv_bak Background vertical mixing coefficient (m2/s)
for momentum.
3.0000E-04 rdrg Linear bottom drag coefficient (m/s).
3.0000E-03 rdrg2 Quadratic bottom drag coefficient.
2.0000E-02 Zob Bottom roughness (m).
3.0000E+00 theta_s S-coordinate surface control parameter.
0.0000E+00 theta_b S-coordinate bottom control parameter.
50.000 Tcline S-coordinate surface/bottom layer width (m) used
in vertical coordinate stretching.
1025.000 rho0 Mean density (kg/m3) for Boussinesq approximation.
0.000 dstart Time-stamp assigned to model initialization (days).
0.00 time_ref Reference time for units attribute (yyyymmdd.dd)
0.0000E+00 Tnudg(01) Nudging/relaxation time scale (days)
for tracer 01: temp
0.0000E+00 Tnudg(02) Nudging/relaxation time scale (days)
for tracer 02: salt
0.0000E+00 Znudg Nudging/relaxation time scale (days)
for free-surface.
0.0000E+00 M2nudg Nudging/relaxation time scale (days)
for 2D momentum.
0.0000E+00 M3nudg Nudging/relaxation time scale (days)
for 3D momentum.
0.0000E+00 obcfac Factor between passive and active
open boundary conditions.
14.000 T0 Background potential temperature (C) constant.
35.000 S0 Background salinity (PSU) constant.
1027.000 R0 Background density (kg/m3) used in linear Equation
of State.
1.7000E-04 Tcoef Thermal expansion coefficient (1/Celsius).
0.0000E+00 Scoef Saline contraction coefficient (1/PSU).
1.000 gamma2 Slipperiness variable: free-slip (1.0) or
no-slip (-1.0).
T Hout(idFsur) Write out free-surface.
T Hout(idUbar) Write out 2D U-momentum component.
T Hout(idVbar) Write out 2D V-momentum component.
T Hout(idUvel) Write out 3D U-momentum component.
T Hout(idVvel) Write out 3D V-momentum component.
T Hout(idWvel) Write out W-momentum component.
T Hout(idOvel) Write out omega vertical velocity.
T Hout(idTvar) Write out tracer 01: temp
T Hout(idTvar) Write out tracer 02: salt
Output/Input Files:
Output Restart File: ocean_rst.nc
Output History File: ocean_his.nc
Output Averages File: ocean_avg.nc
Output Diagnostics File: ocean_dia.nc
Tile partition information for Grid 01: 0041x0080x0016 tiling: 001x001
tile Istr Iend Jstr Jend Npts
0 1 41 1 80 52480
Activated C-preprocessing Options:
UPWELLING Wind-Driven Upwelling/Downwelling over a Periodic Channel
ANA_BSFLUX Analytical kinematic bottom salinity flux.
ANA_BTFLUX Analytical kinematic bottom temperature flux.
ANA_GRID Analytical grid set-up.
ANA_INITIAL Analytical initial conditions.
ANA_SMFLUX Analytical kinematic surface momentum flux.
ANA_SSFLUX Analytical kinematic surface salinity flux.
ANA_STFLUX Analytical kinematic surface temperature flux.
ANA_VMIX Analytical vertical mixing coefficients.
ASSUMED_SHAPE Using assumed-shape arrays.
AVERAGES Writing out time-averaged fields.
DIAGNOSTICS_TS Computing and writing tracer diagnostic terms.
DIAGNOSTICS_UV Computing and writing momentum diagnostic terms.
DJ_GRADPS Parabolic Splines density Jacobian (Shchepetkin, 2002).
DOUBLE_PRECISION Double precision arithmetic.
EW_PERIODIC East-West periodic boundaries.
MIX_S_TS Mixing of tracers along constant S-surfaces.
MIX_S_UV Mixing of momentum along constant S-surfaces.
NONLINEAR Nonlinear Model.
!NONLIN_EOS Linear Equation of State for seawater.
POWER_LAW Power-law shape time-averaging barotropic filter.
PROFILE Time profiling activated .
!RST_SINGLE Double precision fields in restart NetCDF file.
SALINITY Using salinity.
SOLVE3D Solving 3D Primitive Equations.
SPLINES Conservative parabolic spline reconstruction.
TS_U3HADVECTION Third-order upstream horizontal advection of tracers.
TS_C4VADVECTION Fourth-order centered vertical advection of tracers.
TS_DIF2 Harmonic mixing of tracers.
UV_ADV Advection of momentum.
UV_COR Coriolis term.
UV_U3HADVECTION Third-order upstream horizontal advection of 3D momentum.
UV_C4VADVECTION Fourth-order centered vertical advection of momentum.
UV_LDRAG Linear bottom stress.
UV_VIS2 Harmonic mixing of momentum.
VAR_RHO_2D Variable density barotropic mode.
INITIAL: Configuring and initializing forward nonlinear model ...
Vertical S-coordinate System:
level S-coord Cs-curve at_hmin over_slope at_hmax
16 0.0000000 0.0000000 0.000 0.000 0.000
15 -0.0625000 -0.0188264 -1.575 -2.750 -3.925
14 -0.1250000 -0.0383166 -3.150 -5.541 -7.932
13 -0.1875000 -0.0591578 -4.725 -8.417 -12.108
12 -0.2500000 -0.0820849 -6.300 -11.422 -16.544
11 -0.3125000 -0.1079063 -7.875 -14.608 -21.342
10 -0.3750000 -0.1375324 -9.450 -18.032 -26.614
9 -0.4375000 -0.1720078 -11.025 -21.758 -32.492
8 -0.5000000 -0.2125480 -12.600 -25.863 -39.126
7 -0.5625000 -0.2605826 -14.175 -30.436 -46.696
6 -0.6250000 -0.3178051 -15.750 -35.581 -55.412
5 -0.6875000 -0.3862333 -17.325 -41.426 -65.527
4 -0.7500000 -0.4682798 -18.900 -48.121 -77.341
3 -0.8125000 -0.5668375 -20.475 -55.846 -91.216
2 -0.8750000 -0.6853816 -22.050 -64.818 -107.586
1 -0.9375000 -0.8280918 -23.625 -75.298 -126.971
0 -1.0000000 -1.0000000 -25.200 -87.600 -150.000
Time Splitting Weights: ndtfast = 30 nfast = 42
Primary Secondary Accumulated to Current Step
1-0.0008094437383769 0.0333333333333333-0.0008094437383769 0.0333333333333333
What should I do to solve the errors?
Re: roms_matlab plotting and analysis routines
Code: Select all
file = 'ocean_his.nc';
h = nc_varget(file,'h');
(The UPWELLING test case has no masking or grid rotation, so that's why mask_rho etc are not in the file. roms_get_grid only gives a warning when it can't find the masks, and should continue to read the variables it needs while creating masks that haves 1 in all entries so that the other plotting routines work without needing to check for the existence of the masks).
John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Re: roms_matlab plotting and analysis routines
Is it not necessary or has been solved? Thanks
Re: roms_matlab plotting and analysis routines
Use roms_addvect_scale
Code: Select all
>> help roms_addvect_scale
han = roms_addvect_scale(pos,uv,uscale,label,varargin)
pos = [x y] position for scale vector (can use, e.g. ginput(1)
uv = [u v] scale vector
uscale = same scale as used in the roms_quiver command
label = string to label vector, default is 'm/s'
varargin = arguments to quiver, e.g. vector color
Code: Select all
roms_addvect_scale(ginput(1),[0 1],.1,'m/s','r')
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Thanks for these very good tools. i am a beginner for roms.
I'm able to use some of then, but with some options the program complain about specific functions or sub-functions.
For example:
Using:
(1)
>>file='ocean_his.nc'
>>g=roms_get_grid(file,file);
>>roms_zview(file,'temp',1,-5,g,3,s,'k')
file =
ocean_his.nc
Warning: Variable not found: mask_rho
> In roms_get_grid at 57
Warning: Variable not found: mask_psi
> In roms_get_grid at 57
Warning: Variable not found: mask_u
> In roms_get_grid at 57
Warning: Variable not found: mask_v
> In roms_get_grid at 57
Warning: Variable not found: h
> In roms_get_grid at 57
Warning: Variable not found: angle
> In roms_get_grid at 57
??? Reference to non-existent field 'h'.
Error in ==> roms_get_grid at 59
grd = setfield(grd,vname,zeros(size(grd.h)));
(2)
>> file='ocean_his.nc'
>> h = nc_varget(file,'h');
file =
ocean_his.nc
??? Undefined command/function 'nc_varget'.
How to solve it ?
Thanks!
Re: roms_matlab plotting and analysis routines
You can confirm this is the problem with:
>> which nc_varget
If nc_varget, is in your path, then you should also be able to nc_dump the roms file and confirm it has the data in it:
>> file = 'ocean.his'
>> nc_dump(file)
If the nc_dump command exists, but fails, then there is something wrong with the roms file or, more likely, you have given an incorrect path to where it is located.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
-
- Posts: 52
- Joined: Tue Mar 03, 2009 2:39 pm
- Location: C.N.R. - LaMMA
Re: roms_matlab plotting and analysis routines
I am experiencing a similar error trying to plot the upwelling model results. I am using the grd=roms_get_grid('ocean_his.nc') but the command stops because the variables long_rho, lat_rho,.........are absent in the input file. Actually, by using ncload('ocean_his.nc') I have checked that these variables are absent. Any suggestion to run the roms_get_grid properly?
Cheers Maria
Re: roms_matlab plotting and analysis routines
Several months ago I made changes to the code to trap the case that an idealized x,y coordinates grid was used (as in the upwelling example), and in this event the code reads x_rho into lon_rho, etc. It gives a warning, but not a fatal error.
The code version to be use is the version managed with svn and described in the DownLoad section at http://romsmatlab.tiddlyspot.com
Note that roms_get_grid will change again shortly is accommodate the new vertical grid stretching options. I'll post a message to the forum when I update the svn repository.
John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
-
- Posts: 52
- Joined: Tue Mar 03, 2009 2:39 pm
- Location: C.N.R. - LaMMA
Re: roms_matlab plotting and analysis routines
thank you very much for your help.
Actually I used the old version of the routine.
At the present I am trying to plot the vector field related to the "Sed_test1" test case. I have setted the following script:
>> ncload 'ocean_his.nc'
>> vplot=v(11,1,:,:);
>> uplot=u(11,1,:,:);
>> grd=roms_get_grid('ocean_his.nc')
>> roms_quivergrd(uplot,vplot,grd,1,1)
but the plot I get is a empty white immage.
Have you any suggestion?
Thank you again.
Maria
Re: roms_matlab plotting and analysis routines
>> max(uplot(:))
You might need a larger value of uscale.
You can also use roms_sview to plot the individual components to see what sort of values there are.
Note that you are plotting vertical level 1, which is near the seafloor not the surface.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
When i use the roms_wilkin,i found some question:
when i run
Code: Select all
file = '/disk/ROMS/ocean_his.nc';
g=roms_get_grid(file,file);
roms_sview(file,'temp',18,0,g,3,.2,'k') ;
Warning:Variable not found :angle
>In roms_get_grid at 57
???Error using ==>plus
Matrix dimensions must agree.
Error in ==> roms_zslice_var at 97
zl_ind = zl_ind + [1:1:length(zg_ind)]';
Error in ==> roms_zslice at 64
[data,x,y] = roms_zslice_var(data,1,depth,grd);
Error in ==> roms_zview at 152
[data,x,y,t,grd] = roms_zslice(file,var,time,depth,grd);
Thank you very much!
Re: roms_matlab plotting and analysis routines
Re: roms_matlab plotting and analysis routines
Please double check the
uvz_from_clim_stdlev.m
in the matlab plotting routines.
In which, the following two lines
162 velz = -sw_gvel(ga,y',lon(:,I));
168 vel0 = -sw_gvel(ga0,y',lon(:,I));
might be
162 velz = -sw_gvel(ga,y',lon(:,I)');
168 vel0 = -sw_gvel(ga0,y',lon(:,I)');
Thank you.
Re: roms_matlab plotting and analysis routines
Note that the lon and lat arrays should be dimensioned lon(lat,lon) and lat(lat,lon) following the climatology temp and salt(time z lat lon). Unless you have equal dimensions in lon and lat I would expect the code to throw an error if the change you suggest is actually a bug.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
The new version (thank you Hernan) uses two (and only two) functions from Hernan Arango's Matlab utilities (stretching.m and set_depth.m). If you don't already have these, you can either install all of the Arango utilities (managed by svn) or just get the two functions you need from https://www.myroms.org/svn/src/matlab/utility/
If you already have my ROMS matlab routines installed, then all you need to do is an svn update. You will get a few other updates as well - mostly small bug fixes or some added functionality (like saving the u,v values used by quiver to the optional data output of a roms_zview call).
If you want instructions on downloading these functions, see http://romsmatlab.tiddlyspot.com/ or review the previous posts to this topic.
John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
In the file roms_plot_bathy.m line 12 it says
grd = get_roms_grid(grd_file);
I believe the correct function call is
grd = roms_get_grid(grd_file); ?
Eivind
Re: roms_matlab plotting and analysis routines
Thanks, John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I've downloaded the new roms_wilkin version and done all the above in order to obtain the upwelling plot but I've got the following messages:
>> roms_jview(file,'salt',1,5,g);
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
or
>> roms_zview(file,'temp',1,-5,g,3,s,'k')
??? Reference to non-existent field 'angle'.
Error in ==> roms_quivergrd at 55
angle = grd.angle;
Error in ==> roms_zview at 244
[hanquiver,dataq] = roms_quivergrd(u,v,grd,vec_d,uscale,varargin{:});
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
Any suggestion?
Re: roms_matlab plotting and analysis routines
The behavior of nc_varget will likely alter in the near future to avert this problem. I spoke to John Evans about it a week or so ago.
John.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Thank You for the advice, it is working now
Regards.
Re: roms_matlab plotting and analysis routines
Does this Matlab tool require Matlab version higher than 2008a??
Since I use Matlab 2008a ,I downloaded mexcdf.R13.r2723.zip for Matlab2008a, and snctools-2.5.8.tar.gz and test UPWELLING ,
but I get these:
Code: Select all
Warning: Variable not found: mask_rho
> In roms_get_grid at 75
Warning: Variable not found: mask_psi
> In roms_get_grid at 75
Warning: Variable not found: mask_u
> In roms_get_grid at 75
Warning: Variable not found: mask_v
> In roms_get_grid at 75
Warning: Variable not found: angle
> In roms_get_grid at 75
Warning: Variable not found: h
> In roms_get_grid at 75
Warning: Variable not found: pm
> In roms_get_grid at 75
Warning: Variable not found: pn
> In roms_get_grid at 75
Warning: Variable not found: f
> In roms_get_grid at 75
??? Undefined function or variable 'nc_nowrite_mode'.
Error in ==> nc_isvar>nc_isvar_mexnc at 54
[ncid,status] = mexnc('open',ncfile, nc_nowrite_mode );
Error in ==> nc_isvar at 40
bool = nc_isvar_mexnc ( ncfile, varname );
Error in ==> roms_get_grid at 80
if nc_isvar(grd_file,'x_rho')
Do i have to install Matlab2008b or higher?
The tutorial I'm following at
https://www.myroms.org/wiki/index.php/R ... ith_Matlab used Matlab2008b.
Re: roms_matlab plotting and analysis routines
In matlab, try:
nc_dump(file)
to see the contents. If this is your ROMS input grid file you should at least have x_rho etc or lon_rho etc, h, pm, and pn.
If it is a ROMS output file, the metrics should have been written to the file by ROMS itself.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I used it to make a kmz of the prototype plot we used when designing the ROMS Hawaii Workshop T-shirt:
http://marine.rutgers.edu/~wilkin/hi/Ro ... nShirt.kmz
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
closest.m from the roms_wilkin set of routines is a useful routine for trying to find the nearest grid point to a lat/lon position. I find a tiny issue when a desired point is exactly mid-way between roms grid points. The following section of code crashes when ii and jj, returned by find(), are vectors and not scalars.
Code: Select all
36 for k=1:length(xi)
37 dist = abs( (xi(k)-X) + sqrt(-1)*(yi(k)-Y));
38 [ii,jj] = find(dist==min(dist(:)));
39 i(k) = ii;
40 j(k) = jj;
41 dist = min(dist(:));
42 end
Code: Select all
36 for k=1:length(xi)
37 dist = abs( (xi(k)-X) + sqrt(-1)*(yi(k)-Y));
38 [ii,jj] = find(dist==min(dist(:)));
39 i(k) = ii(1);
40 j(k) = jj(1);
41 dist = min(dist(:));
42 end
Chris
Re: roms_matlab plotting and analysis routines
thanks
Rafael
>> h = nc_varget(hfile,'h');
>> g=roms_get_grid(hfile); % the grid structure
Warning: Variable not found: angle
Re: roms_matlab plotting and analysis routines
Re: roms_matlab plotting and analysis routines
In my plotting routines that draw vectors, the angle (between the grid i,j direction and x,y) is required to rotate the vectors before they are drawn by Matlab quiver.
If the ROMS application does not use the angle rotation (like many of the analytical examples) then its easiest just to generate internally an 'angle' variable and fill it with zeros in order apply no rotation by default. But I put that warning there in case you did mean to rotate coordinates - so that you know something is wrong. Otherwise the code does not throw an error because it sets angle = 0 and keeps going.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
-
- Posts: 9
- Joined: Fri Oct 08, 2010 4:46 pm
- Location: Bangor University
Re: roms_matlab plotting and analysis routines
This is a really useful thread and sorry to revisit a simple problem but running the upwelling test case I get the same error that rgon did back in Nov 2009 but now I’m running Matlab R2011a (7.12.0). I have checked out the latest matlab functions from tiddlyspot.com and I’ve downloaded the latest SNCTOOLS (R2010b and Beyond). I’ve tried activating/editing/removing the section of code (x=double(x) etc) that converts the variable into double-precision in pcolorjw.m (as per John’s suggestion on 10th Nov 09) yet I still get the warning:
Warning: CData must be double or uint8
I’m obviously missing something fundamental but I’m not sure what it is, considering I’ve got all the latest versions (was nc_varget altered to avert this problem?) and am assured by matlab help that if a variable is already a double then it ignores this command?? Any help/suggestions much appreciated.
Many thanks in advance
Re: roms_matlab plotting and analysis routines
Make sure the pcolorjw etc you are using are the ones you intend - maybe you have more than one in your Matlab path. Use ...
Code: Select all
>> which pcolorjw -all
Also, Matlab has an easy interactive debugger. Put a keyboard command in the code somewhere before the error, and check that the data are indeed type double.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
-
- Posts: 9
- Joined: Fri Oct 08, 2010 4:46 pm
- Location: Bangor University
Re: roms_matlab plotting and analysis routines
Code: Select all
data=double(data);
hanpc = pcolorjw(x,y,data.*mask);
Sophie
Re: roms_matlab plotting and analysis routines
I try to use the John's matlab toolbox. I have installed snctools.
But when I try to use it, I have some errors.
The first one:
Code: Select all
>> roms_zview('ruisseau_his.nc','ubar','01-Jan-0001 00:00:00',0,'ruisseau_grd.nc',3,.1,'k')
??? Error using ==> netcdflib
Variable ID retrieval failed, library error message "NetCDF: Variable not found"
Error in ==> inqVarID at 21
varid = netcdflib('inq_varid', ncid, varname);
Error in ==> nc_varget_tmw>nc_varget_tmw_group at 46
varid=netcdf.inqVarID(ncid,varname);
Error in ==> nc_varget_tmw at 25
values = nc_varget_tmw_group(ncfile,gid,local_varname,start,count,stride);
Error in ==> nc_varget at 47
data = nc_varget_tmw(ncfile,varname,start,count,stride);
Error in ==> roms_get_grid at 177
theta_s = nc_varget(scoord,'theta_s');
Error in ==> roms_2dslice at 62
grd = roms_get_grid(grd,file);
Error in ==> roms_zview at 135
[data,x,y,t,grd] = roms_2dslice(file,var,time,grd);
and when I try with an other application, I have this second error:
Code: Select all
>> roms_zview('upwelling_his.nc','umag','01-Jan-0001 00:00:10',0,'reunion_grd.nc')
??? Undefined function or method 'stretching' for input arguments of type 'int32'.
Error in ==> roms_get_grid at 199
[s_rho,Cs_r]=stretching(Vstretching, theta_s, theta_b, hc, N, 0, 0);
Error in ==> roms_zslice at 51
grd = roms_get_grid(grd,file);
Error in ==> roms_zview at 138
[datau,x,t,t,grd] = roms_zslice(file,'u',time,depth,grd);
If someone know how to do, please help me.
Thanks in advance,
Antoine
Re: roms_matlab plotting and analysis routines
I suggest you update your roms_wilkin code using svn.
I took "stretching" and "set_depth" out of roms_get_grid because it is better practice to use the vertical coordinate stretching functions from the myroms repository (Hernan Arango's utilities). This way when new stretching options are added you will get those promptly.
I updated, today, the "help" on roms_zview to emphasize I recommend computing the grd structure once and then passing it to roms_zview on subsequent calls. This avoids needlessly recomputing the coordinates.
I say this because you may be having trouble using the grid netcdf file as the grid argument to roms_get_grid. This forces the function to the load the horizontal coordinates on each call from the grid file, then go to the output file (in your case 'ruisseau_his.nc') to find the vertical stretching parameters (theta_s, etc.) and compute z_r and z_w. However, in my test today this method does work so I could not reproduce your error for your combination of inputs: var='ubar', depth=0, etc.
Also, I generally advise against using depth 0 with roms_zview because with zeta=0 (which is assumed if you don't specify otherwise), the depth of the shallowest rho points is strictly < 0. But it should work anyway. In your case, you are asking for a 2-D variable (ubar) so it doesn't really matter. I tested it and it works for me.
To plot on s-levels, use roms_sview instead. It's probably faster.
In case you still have trouble, these work with my version of the codes:
Code: Select all
f = 'http://tashtego.marine.rutgers.edu:8080/thredds/dodsC/roms/espresso/2009_da/avg';
grd = roms_get_grid(f,f);
roms_zview(f,'ubar','18-Jan-2010',0,grd)
f = 'http://tashtego.marine.rutgers.edu:8080/thredds/dodsC/roms/espresso/2009_da/avg'
roms_zview(f,'ubar','18-Jan-2010',0,f)
This works:
Code: Select all
f = 'http://tashtego.marine.rutgers.edu:8080/thredds/dodsC/roms/espresso/2009_da/avg'
roms_zview(f,'umag','18-Jan-2010',-10,f)
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I update my roms_wilkin code and I have another error, even if I try with your files. Function roms_cgridpos desn't manage to determine the C grid location. I have the following error:
Code: Select all
??? Error using ==> roms_cgridpos at 39
Could not determine C-grid location
Error in ==> roms_2dslice at 70
switch roms_cgridpos(size(data),grd)
Error in ==> roms_zview at 140
[data,x,y,t,grd] = roms_2dslice(file,var,time,grd);
Error in ==> essai at 3
roms_zview(f,'ubar','18-Jan-2010',0,grd)
-
- Posts: 3
- Joined: Fri Dec 01, 2006 5:10 am
- Location: Arizona State University
Re: roms_matlab plotting and analysis routines
I have ROMS installed. It compiles, runs, and writes the *.nc files.
I have the scntools and mexnc installed. I have also obtained the matlab plotting routines via svn (Checked out revision 402). I can read the ocean-his file from the upwelling testcase (file = 'ocean_his.nc';) and read in a variable from the file (h = nc_varget(file,'h');) as suggested above. I can then look at the varibale content:
So I guess my netcdf and matlab setup are correct (I am using matlab 2010b).>> h
h =
Columns 1 through 10
25.2005 25.2005
....
However, I can, as one poster above, not read in and plot the test case using the roms plot routines as it gives me masking errors. Could someone tell me how I can make the upwelling case plotable with the routines?
>>
>> file = 'ocean_his.nc'
file =
ocean_his.nc
>> g=roms_get_grid(file,file); % the grid structure
Warning: Variable not found: mask_rho
> In roms_get_grid at 74
Warning: Variable not found: mask_psi
> In roms_get_grid at 74
Warning: Variable not found: mask_u
> In roms_get_grid at 74
Warning: Variable not found: mask_v
> In roms_get_grid at 74
Warning: Variable not found: angle
> In roms_get_grid at 74
Warning: lon_rho not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lat_rho not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lon_psi not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lat_psi not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lon_v not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lat_v not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lon_u not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lat_u not found. Substituting x/y coords instead
> In roms_get_grid at 107
??? Undefined function or method 'stretching' for input arguments of type 'int32'.
Error in ==> roms_get_grid at 199
[s_rho,Cs_r]=stretching(Vstretching, theta_s, theta_b, hc, N, 0, 0);
>>
Thank you very much in advance for your time and help.
Achim
Re: roms_matlab plotting and analysis routines
The error you get indicates Matlab does not have "stretching.m"I took "stretching" and "set_depth" out of roms_get_grid because it is better practice to use the vertical coordinate stretching functions from the myroms repository (Hernan Arango's utilities). This way when new stretching options are added you will get those promptly.
It is amongst the matlab utility files in myroms.org.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
-
- Posts: 3
- Joined: Fri Dec 01, 2006 5:10 am
- Location: Arizona State University
Re: roms_matlab plotting and analysis routines
thanks in advance
>> which stretching.m
/mexcdf/plotting_routines/stretching.m
>> file = 'ocean_his.nc'
file =
ocean_his.nc
>> g=roms_get_grid(file,file); % the grid structure
Warning: Variable not found: mask_rho
> In roms_get_grid at 74
...
Re: roms_matlab plotting and analysis routines
Are you planning to implement the routines under heading "RomsPlots" of this toolbox to AGRIF version of ROMS? I think it would be great if so.
Regards.
David.
Re: roms_matlab plotting and analysis routines
The message you note is only a Matlab warning. roms_get_grid always attempts to load the land/sea mask, but if the application does not generate one it proceeds anyway. I could turn off the warning, but at the risk of having other people confused if for some reason the mask should be there but is not. It's hard to anticipate every error that users might make configuring the model.Thanks for the quick reply. I have the "stretching.m" and "set_depth.m" in a folder that is a path linked in matlab. I can open the files so they are accesible to matlab, but I sill have the same problem. Any other suggestions?
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I increasingly assume use of the CF-conventions in netcdf files when I write plotting and analysis routines.Hello Mr. Wilkin,
Are you planning to implement the routines under heading "RomsPlots" of this toolbox to AGRIF version of ROMS? I think it would be great if so.
Regards.
David.
This makes code more robust and less susceptible to programming errors. If the output of the ROMS-Agrif were to make more extensive of CF-conventions in the netcdf metadata (the attributes) it would be a relatively straightforward step to make my code more interoperable because I would not need to write anything special to recognize different conventions for specifying the vertical coordinates. That would be handled by netcdf-java.
But it's just not a high priority for me. Sorry.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
my matlab is R2010a.
after install all the plotting packages.here is the results, thank you very much for your help.
>> roms_zview(file, 'temp', 2,-5, g,2,0.2, 'k')
??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> roms_zslice_var at 78
z = [-Inf*ones([1 L*M]); z; zeros([1 L*M])];
Error in ==> roms_zslice at 64
[data,x,y] = roms_zslice_var(data,1,depth,grd);
Error in ==> roms_zview at 157
[data,x,y,t,grd] = roms_zslice(file,var,time,depth,grd);
and the roms_get_grid results:
>> g=roms_get_grid(file, file)
Warning: Variable not found: mask_rho
> In roms_get_grid at 74
Warning: Variable not found: mask_psi
> In roms_get_grid at 74
Warning: Variable not found: mask_u
> In roms_get_grid at 74
Warning: Variable not found: mask_v
> In roms_get_grid at 74
Warning: Variable not found: angle
> In roms_get_grid at 74
Warning: lon_rho not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lat_rho not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lon_psi not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lat_psi not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lon_v not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lat_v not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lon_u not found. Substituting x/y coords instead
> In roms_get_grid at 107
Warning: lat_u not found. Substituting x/y coords instead
> In roms_get_grid at 107
g =
grd_file: 'ocean_avg.nc'
h: [43x82 double]
pm: [43x82 double]
pn: [43x82 double]
f: [43x82 double]
angle: [43x82 double]
x_rho: [43x82 double]
y_rho: [43x82 double]
x_u: [42x82 double]
y_u: [42x82 double]
x_v: [43x81 double]
y_v: [43x81 double]
x_psi: [42x81 double]
y_psi: [42x81 double]
lon_rho: [43x82 double]
nolatlon: 1
lat_rho: [43x82 double]
lon_psi: [42x81 double]
lat_psi: [42x81 double]
lon_v: [43x81 double]
lat_v: [43x81 double]
lon_u: [42x82 double]
lat_u: [42x82 double]
mask_rho: [43x82 double]
mask_rho_nan: [43x82 double]
mask_u: [43x81 double]
mask_v: [42x82 double]
mask_psi: [42x81 double]
nomask: 1
zeta: [43x82 double]
z_r: [16x43x82 double]
z_w: [17x43x82 double]
Vtransform: 2
Vstretching: 4
theta_s: 3
theta_b: 0
Tcline: 25
N: 16
hc: 25
sc_w: [1x17 double]
Cs_w: [1x17 double]
sc_r: [1x16 double]
Cs_r: [1x16 double]
s_w: [1x17 double]
s_rho: [1x16 double]
Re: roms_matlab plotting and analysis routines
Tell me the result of size(z) in roms_zslice_var.m at line 73 - either by uncommenting that line or using the debugger.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
the line 71 is the reshape statement for z, before line 71, the size(z) is:
>> size(z)
ans =
17 43 82
after the reshape statement, size(z) becomes
size(z)
ans =
17 3526
[/color]
at then at line 78, all variables gone!
??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> roms_zslice_var at 78
z = [-Inf*ones([1 L*M]); z; zeros([1 L*M])];
and if I comment out the line 78, here is the result:
>> roms_zview(file, 'temp', 2, -5, g, 0.2, 'k')
??? Index exceeds matrix dimensions.
Error in ==> roms_zslice_var at 91
data_greater_z = data(zg_ind);
Error in ==> roms_zslice at 64
[data,x,y] = roms_zslice_var(data,1,depth,grd);
Error in ==> roms_zview at 157
[data,x,y,t,grd] = roms_zslice(file,var,time,depth,grd);
thanks for your help.
wilkin wrote:Hmmm. I don't see anything obvious but then I don't know the contents of your netcdf file.
Tell me the result of size(z) in roms_zslice_var.m at line 73 - either by uncommenting that line or using the debugger.
Re: roms_matlab plotting and analysis routines
In my initial trials to utilize this efficient matlab package, I have few doubts (as follows) and need some advice to overcome them:
1. While plotting temperature using roms_zview, the plot came out fine, however the vectors were not visible. Vectors I suppose should work with:
s = 0.5;
roms_zview(hisfile,'temp',1,-10,p,10,s,'k')
2. Plotting vectors with u,v using
roms_quivergrd(ubot,vbot,p,10,1)
This gave a blank image........
To make sure the range of data I am working with:
max(max(ubot))= 4.1737
max(max(vbot))= 1.0127
min(min(ubot))= -3.9670
min(min(vbot))= -1.0410
The size my ubot and vbot are:
size(ubot)=199x226
size(vbot)=198x227
3. With bathymetry plot, I could not really plot it:
while trying these commands:-
roms_plot_bathy(p,zebra(2,64),[100 250 500 10004000],h)
OR
roms_plot_bathy(p,zebra(2,64),[100 250 500 10004000],'h')
gave following error:
??? Undefined function or method 'sawtooth' for input arguments of type 'double'.
Error in ==> zebra at 29
sat = m+(1-m)*(0.5*(1+sawtooth(2*pi*x/(n/a))));
In this case, probably I am not using this command correclty!
thanks, nilima
Re: roms_matlab plotting and analysis routines
Code: Select all
roms_plot_bathy(p,jet(64),[100 250 500 1000:1000:4000],'h')
Code: Select all
pcolor(lon_rho,lat_rho,h)
To choose a suitable scale for your vectors try not decimating them so much. You are asking for every 10th vector. You should also be guided by typical magnitudes, not min/max. i.e. consider mean(abs(ubot(:)+i*vbot(:))). You might have one large vector dominating your calculation, and the decimation might have eliminated it from the plot.
The quiver scaling also depends on the grid coordinates you are plotting in, not just the velocity.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I had the same error that rouf said when i used roms_get_grid Function, I am actually new in using ROMS,
When I run these two commands:
code :
file='estuary_his_0001.nc';
grd=roms_get_grid(file,file);
error:
>> plot_mesh
??? Undefined function or method 'isnc3' for input arguments of type
'char'.
Error in ==> nc_isvar>determine_retrieval_method at 48
file_is_nc3 = exist(ncfile,'file') && isnc3(ncfile);
Error in ==> nc_isvar at 33
nc_method = determine_retrieval_method(ncfile);
Error in ==> roms_get_grid at 98
if nc_isvar(grd_file,'x_rho')
Error in ==> plot_mesh at 10
grd=roms_get_grid(file,file);
when i change nc_varget to ncread then have these error.
Re: roms_matlab plotting and analysis routines
There is no plot_mesh command in my code. If you've received these routines third hand from someone else perhaps they can help you.error:
>> plot_mesh
??? Undefined function or method 'isnc3' for input arguments of type
'char'.
You can't switch between nc_varget and ncread because those functions follow a different protocol for returning the order of dimensions. Your data will be transposed and matrix operations will be unconforming.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
thanks ,plot_mesh.m is my code name for plot my study area mesh.if i don't change,the error iswilkin wrote:There is no plot_mesh command in my code. If you've received these routines third hand from someone else perhaps they can help you.error:
>> plot_mesh
??? Undefined function or method 'isnc3' for input arguments of type
'char'.
You can't switch between nc_varget and ncread because those functions follow a different protocol for returning the order of dimensions. Your data will be transposed and matrix operations will be unconforming.
Warning: Variable not found: mask_rho
> In roms_get_grid at 85
In plot_mesh at 10
Warning: Variable not found: mask_psi
> In roms_get_grid at 85
In plot_mesh at 10
Warning: Variable not found: mask_u
> In roms_get_grid at 85
In plot_mesh at 10
Warning: Variable not found: mask_v
> In roms_get_grid at 85
In plot_mesh at 10
Warning: Variable not found: h
> In roms_get_grid at 85
In plot_mesh at 10
Warning: Using initial bath for h
> In roms_get_grid at 90
In plot_mesh at 10
??? Undefined function or method 'snc_read_backend' for input arguments
of type 'char'.
Error in ==> nc_varget at 66
retrieval_method = snc_read_backend(ncfile);
Error in ==> roms_get_grid at 91
grd.(vname) = squeeze(...
i see nc_varget.m in this nc_varget.m in http://romsmatlab.tiddlyspot.com/
but i don't know how to get it
Re: roms_matlab plotting and analysis routines
There are instructions at http://romsmatlab.tiddlyspot.com under DownLoad on where to get the snctools that include nc_varget.m. Sorry if it wasn't clear these tools require snctools.Error in ==> roms_get_grid at 91
grd.(vname) = squeeze(...
i see nc_varget.m in this nc_varget.m in http://romsmatlab.tiddlyspot.com/
but i don't know how to get it
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
thanks very much,it can run!wilkin wrote:There are instructions at http://romsmatlab.tiddlyspot.com under DownLoad on where to get the snctools that include nc_varget.m. Sorry if it wasn't clear these tools require snctools.Error in ==> roms_get_grid at 91
grd.(vname) = squeeze(...
i see nc_varget.m in this nc_varget.m in http://romsmatlab.tiddlyspot.com/
but i don't know how to get it
now i want to your help,i want to plot mesh with topography,my code is
lat=ncread('estuary_his_0008.nc','lat_rho');
lon=ncread('estuary_his_0008.nc','lon_rho');
m_proj('miller','lon',[117 134],'lat',[15 43]);
m_grid('linestyle','none','box','fancy','tickdir','in','xtick',117:4:134,'ytick',15:4:43);
m_gshhs_i('patch',[.6 .6 .6])
hold on
addpath('J:\east\east preference\ROMSprocess\');
file=('G:\mysoftware\bin\delft2roms\case2\smooth_east_grd3_728.nc');
grd=roms_get_grid(file);
roms_plot_mesh(grd,1,[0 0 0],'rho');
but my figure is
Re: roms_matlab plotting and analysis routines
Looks to me like you're mixing plotting using the Rich Pawlowicz m_map mapping toolbox (m_grid etc.) with regular Matlab plotting inside roms_plot_mesh.m_proj('miller','lon',[117 134],'lat',[15 43]);
m_grid('linestyle','none','box','fancy','tickdir','in','xtick',117:4:134,'ytick',15:4:43);
m_gshhs_i('patch',[.6 .6 .6])
hold on
addpath('J:\east\east preference\ROMSprocess\');
file=('G:\mysoftware\bin\delft2roms\case2\smooth_east_grd3_728.nc');
grd=roms_get_grid(file);
roms_plot_mesh(grd,1,[0 0 0],'rho');
If you want to plot in map coordinates borrow the code out of roms_plot_mesh.m for the options you are selecting and replace the calls to plot with calls to m_line.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
ok ,thankswilkin wrote:Looks to me like you're mixing plotting using the Rich Pawlowicz m_map mapping toolbox (m_grid etc.) with regular Matlab plotting inside roms_plot_mesh.m_proj('miller','lon',[117 134],'lat',[15 43]);
m_grid('linestyle','none','box','fancy','tickdir','in','xtick',117:4:134,'ytick',15:4:43);
m_gshhs_i('patch',[.6 .6 .6])
hold on
addpath('J:\east\east preference\ROMSprocess\');
file=('G:\mysoftware\bin\delft2roms\case2\smooth_east_grd3_728.nc');
grd=roms_get_grid(file);
roms_plot_mesh(grd,1,[0 0 0],'rho');
If you want to plot in map coordinates borrow the code out of roms_plot_mesh.m for the options you are selecting and replace the calls to plot with calls to m_line.
Re: roms_matlab plotting and analysis routines
pingding wrote:wilkin wrote:Looks to me like you're mixing plotting using the Rich Pawlowicz m_map mapping toolbox (m_grid etc.) with regular Matlab plotting inside roms_plot_mesh.m_proj('miller','lon',[117 134],'lat',[15 43]);
m_grid('linestyle','none','box','fancy','tickdir','in','xtick',117:4:134,'ytick',15:4:43);
m_gshhs_i('patch',[.6 .6 .6])
hold on
addpath('J:\east\east preference\ROMSprocess\');
file=('G:\mysoftware\bin\delft2roms\case2\smooth_east_grd3_728.nc');
grd=roms_get_grid(file);
roms_plot_mesh(grd,1,[0 0 0],'rho');
If you want to plot in map coordinates borrow the code out of roms_plot_mesh.m for the options you are selecting and replace the calls to plot with calls to m_line.
thanks very much, i plot it,but i plot mesh in map coordinates use m_line instead of plot of roms_plot_mesh.m
also with error:
Attempt to reference field of non-structure array.
Error in m_ll2xy (line 35)
if strcmp(MAP_COORDS.name,MAP_PROJECTION.coordsystem.name),
Error in m_line (line 46)
[X,Y]=m_ll2xy(long,lat,'clipping',clp);
Error in plot_mesh (line 10)
hline1=m_line(long,lat);
i don't know uderstand untill now,so i try to use m_plot,it work;
code:lat=ncread('estuary_his_0008.nc','lat_rho');
lon=ncread('estuary_his_0008.nc','lon_rho');
m_proj('miller','lon',[117 134],'lat',[15 43]);
m_grid('linestyle','none','tickdir','in','xtick',117:4:134,'ytick',15:4:43);
hold on
file=('G:\mysoftware\bin\delft2roms\case2\smooth_east_grd3_728.nc');
grd=roms_get_grid1(file);
n=5;
lat=grd.lat_rho(1:n:end,1:n:end);
long=grd.lon_rho(1:n:end,1:n:end);
hold on
m_plot(long,lat,'color','k');
hold on
m_plot(long',lat','color','k');
hold on
m_gshhs_i('color','k')
-
- Posts: 2
- Joined: Fri Jan 15, 2016 2:29 pm
- Location: Universidad Tecnica Federico Santa Maria
Re: roms_matlab plotting and analysis routines
I have ROMS installed and all necessary paths (scntools and mexnc installed). I can read the ocean-his file from the upwelling testcase (file = 'ocean_his.nc';) and read in a variable from the file (h = nc_varget(file,'h');) too.
Code: Select all
file='ocean_his.nc';
g=roms_get_grid(file,file);
h=nc_varget(file,'h');
roms_zview(file,'temp',1,2,g,3,0.1,'k')
Warning: Variable not found: mask_rho
> In roms_get_grid at 84
In untitled3 at 9
Warning: Variable not found: mask_psi
> In roms_get_grid at 84
In untitled3 at 9
Warning: Variable not found: mask_u
> In roms_get_grid at 84
In untitled3 at 9
Warning: Variable not found: mask_v
> In roms_get_grid at 84
In untitled3 at 9
Warning: Variable not found: angle
> In roms_get_grid at 84
In untitled3 at 9
Warning: Variable not found: dmde
> In roms_get_grid at 84
In untitled3 at 9
Warning: Variable not found: dndx
> In roms_get_grid at 84
In untitled3 at 9
Warning: Variable not found: visc_factor
> In roms_get_grid at 84
In untitled3 at 9
Warning: Variable not found: diff_factor
> In roms_get_grid at 84
In untitled3 at 9
Warning: lon_rho not found. Substituting x/y coords instead
> In roms_get_grid at 118
In untitled3 at 9
Warning: lat_rho not found. Substituting x/y coords instead
> In roms_get_grid at 118
In untitled3 at 9
Warning: lon_psi not found. Substituting x/y coords instead
> In roms_get_grid at 118
In untitled3 at 9
Warning: lat_psi not found. Substituting x/y coords instead
> In roms_get_grid at 118
In untitled3 at 9
Warning: lon_v not found. Substituting x/y coords instead
> In roms_get_grid at 118
In untitled3 at 9
Warning: lat_v not found. Substituting x/y coords instead
> In roms_get_grid at 118
In untitled3 at 9
Warning: lon_u not found. Substituting x/y coords instead
> In roms_get_grid at 118
In untitled3 at 9
Warning: lat_u not found. Substituting x/y coords instead
> In roms_get_grid at 118
In untitled3 at 9
Attempt to reference field of non-structure array.
Error in roms_zslice (line 51)
time_variable = Iv.Dimensions(end).Name;
Error in roms_zview (line 163)
[data,x,y,t,grd] = roms_zslice(file,var,time,depth,grd);
Error in untitled3 (line 11)
roms_zview(file,'temp',1,2,g,3,0.1,'k')
Pd: I know "Warning" are not a problem.
Re: roms_matlab plotting and analysis routines
Code: Select all
Error in roms_zslice (line 51)
time_variable = Iv.Dimensions(end).Name;
Error in roms_zview (line 163)
[data,x,y,t,grd] = roms_zslice(file,var,time,depth,grd);
Error in untitled3 (line 11)
roms_zview(file,'temp',1,2,g,3,0.1,'k')
Check that your nc_vinfo (in Maltba >> which nc_vinfo) is the nc_vinfo from the ROMS Matlab repository (https://www.myroms.org/svn/src/matlab/netcdf) which you should be downloading using svn: svn checkout https://www.myroms.org/svn/src/matlab MyDir
If that's OK, then set a debug stop inside roms_zslice
Code: Select all
>> dbstop in roms_zslice
Code: Select all
K>> Iv = nc_vinfo(file,var)
Code: Select all
K>> Iv.Dimensions.Name
ans =
xi_rho
ans =
eta_rho
... etc. and
ans =
ocean_time
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Thank you so much for sharing the roms tools with everybody. I really appreciate it. Running roms_zview and roms_zslice, I'm also running into the problem of getting
Attempt to reference field of non-structure array.
Error in roms_zslice (line 51)
time_variable = Iv.Dimensions(1,1).Name;
Error in roms_zview (line 163)
[data,x,y,t,grd] = roms_zslice(file,var,time,depth,grd);
When I do
Iv = nc_vinfo(file,var)
I get
Iv =
ocean_time
s_rho
eta_rho
xi_rho
ncdump of my output file includes the following:
double ocean_time(ocean_time) ;
ocean_time:long_name = "averaged time since initialization" ;
ocean_time:units = "seconds since 1900-01-01 00:00:00" ;
ocean_time:calendar = "gregorian" ;
ocean_time:field = "time, scalar, series" ;
float zeta(ocean_time, eta_rho, xi_rho) ;
zeta:long_name = "time-averaged free-surface" ;
zeta:units = "meter" ;
zeta:time = "ocean_time" ;
zeta:coordinates = "lon_rho lat_rho ocean_time" ;
zeta:field = "free-surface, scalar, series" ;
zeta:_FillValue = 1.e+37f ;
How could I solve this issue?
Thanks a lot,
Claudine
Re: roms_matlab plotting and analysis routines
Code: Select all
Iv = nc_vinfo(file,var)
Is your nc_vinfo.m up to date?K>> Iv = nc_vinfo(file,var)
Iv =
Filename: 'http://tds.marine.rutgers.edu/thredds/d ... sso/2013_d...'
Name: 'temp'
Dimensions: [1x4 struct]
Size: [130 82 36 27684]
Attributes: [1x8 struct]
Cgridtype: [1x1 struct]
Datatype: 'single'
ncType: 5
If you meant you checked
Code: Select all
Iv.Dimensions.Name
You may have the dimensions coming back in the wrong order (for roms_zslice.m).K>> Iv.Dimensions.Name
ans =
xi_rho
ans =
eta_rho
ans =
s_rho
ans =
time
We have seen this before for some netCDF-4 files. The problem went away if the files were converted to netCDF-3, or if the netCDF-4 files were served by OPeNDAP.
What are you trying to read - nc3, nc4, or Opendap?
I think we found a workaround for the problem but I can't recall right now what it was. Let me check with the team.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
When I do
Code: Select all
Iv = nc_vinfo(file,var)
andIv =
ocean_time
s_rho
eta_rho
xi_rho
Code: Select all
Iv.Dimensions.Name
There is something funky going on with my nc_vinfo.m. I downloaded it yesterday from https://github.com/dcherian/tools/blob/ ... nc_vinfo.m. Is there a better place to get it?Attempt to reference field of non-structure array.
Also, I think you are right that the dimensions are coming back in the wrong order. The format is "netCDF-4/HDF5 file" Conventions = "CF-1.4". Please let me know if you remember how to get around this problem -especially if it is an easier fix than converting all files.
Thanks,
Claudine
Re: roms_matlab plotting and analysis routines
That distribution by Deepak Cherian on github of Hernan Arango's netcdf utilities for ROMS is woefully out of date.There is something funky going on with my nc_vinfo.m. I downloaded it yesterday from https://github.com/dcherian/tools/blob/ ... nc_vinfo.m. Is there a better place to get it?
You should get Hernan's utilities from the myroms code source at the same place you got ROMS:
https://www.myroms.org/projects/src/browser
So download with svn:
svn checkout https://www.myroms.org/svn/src/matlab MyDir
(It's possible that the old version is required by some code of Deepak's own creation that he has on github, so you'll just have to deal with that as you encounter issues.)
I notice Deepak is also redistributing my ROMS plotting tools. Is that where you got them? Then they are out of date also.
The place to get them is:
svn checkout https://www.myroms.org/svn/om/matlab/roms_wilkin MyDir
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Re: roms_matlab plotting and analysis routines
I am also trying to use Roms_wilkin for plotting Roms results.
When I used the following instruction for upwelling test case:
file = 'ocean_his.nc'
g=roms_get_grid(file,file)
s = 0.1;
roms_zview(file,'temp',1,-5,g,3,s,'k')
the problem was
Error using ncread
Too many input arguments.
Error in roms_zslice (line 56)
t = ncread(file,time_variable,time,1);
Error in roms_zview (line 141)
[data,x,y,t,grd] = roms_zslice(file,var,time,depth,grd);
I really do not know why.
Could anyone help me
Re: roms_matlab plotting and analysis routines
Thanks
Re: roms_matlab plotting and analysis routines
I'm also testing the upwelling case in matlab. I'm trying to follow the instructions, and what I get is this:
>> filename='ocean_his.nc'
filename =
ocean_his.nc
>> grd = roms_get_grid(filename,filename)
Warning: Using initial bath for h
> In roms_get_grid (line 95)
Undefined function or variable 'nc_varget'.
Error in roms_get_grid (line 97)
nc_varget(grd_file,'bath',[0 0 0],[1 -1 -1]));
Thanks for your help.
Hans
Re: roms_matlab plotting and analysis routines
>> help roms_wilkin
that should direct you to some old documentation on this code at http://romsmatlab.tiddlyspot.com/ that explains that I use snctools (which has nc_varget etc.) for the netcdf read.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I just want to start off with a simple plot. Is it possible or feasible to plot pcolor(x_rho, y_rho, h)?
I'm getting the following:
file = 'ocean_his.nc';
x_rho=ncread(file,'x_rho');
y_rho=ncread(file,'y_rho');
h=ncread(file,'h');
mymap=pcolor(x_rho, y_rho, h)
with no figure. How do I get a figure? Sorry about the basic questions!
-
- Posts: 7
- Joined: Tue Jun 28, 2016 7:00 pm
Re: roms_matlab plotting and analysis routines
hclarke wrote: with no figure. How do I get a figure? Sorry about the basic questions!
Just do pcolor(x_rho, y_rho, h). Matlab has very good documentation.
Re: roms_matlab plotting and analysis routines
Warning: MATLAB has disabled some advanced graphics rendering features by
switching to software OpenGL. For more information, click <a
href="matlab:opengl('problems')">here</a>.
The second time I tried it, I get nothing.
P.S. Am I supposed to get lat_rho and long_rho in my upwelling output?
Re: roms_matlab plotting and analysis routines
>> peaks
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I have successfully plotted the upwelling case, but now I want to plot it at a different times and even set up a bunch of times to be able to animate them. Can someone point me in the right direction in terms of the wilkin routines or otherwise?
Thanks
Re: roms_matlab plotting and analysis routines
I've used:
>> file = 'ocean_his.nc'
>> g=roms_get_grid(file,file)
>> roms_iview(file,'temp','1-Jan-0001',1,g,1)
then compared the plot with:
>> roms_iview(file,'temp','6-Jan-0001',1,g,1).
I've attached the figures. Is this what I'm supposed to be seeing? There is distortion to the left of the latter plot. Is that the upwelling?
- Attachments
-
- Upwelling figures.docx
- (56.84 KiB) Downloaded 1946 times
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: roms_matlab plotting and analysis routines
I am using your roms_matlab plotting and analysis routines for the first time to plot observations for my model and unfortunately I encountered some errors. I was successful with plotting the upwelling results with your package. But as I try to implement them on my output files of my model, I use the following command:
Code: Select all
>> file = 'Lombok_roms_his.nc'
file =
'Lombok_roms_his.nc'
>> grd=roms_get_grid(file,file); % the grid structure
>> roms_zview(file,'u','1-Jan-2020',-1,grd)
This is the only function I face error with. As per the TiddlyWiki website in which you maintain these routines, it's written " Produces a pcolor plot of the requested VarName at constant depth. If requested, velocity vectors are plotted over the image according to the inputs Vec_d, UScale and varargin." And the depth parameter in the function says that it's depth in z direction of a 3D ROMS grid. I don't know where my plot's going wrong in that case. I have a total of 15 vertical levels in my grid file and my model is also a 3D model with the following resolution Resolution, Grid 01: 98x48x7.Index exceeds the number of array elements (84150).
Error in roms_zslice_var (line 83)
data_greater_z = data(zg_ind);
Error in roms_zslice (line 81)
[data,x,y] = roms_zslice_var(data,1,depth,grd);
Error in roms_zview (line 177)
data = roms_zslice(file,var,time,depth,grd);
Is there some data missing in my his.nc file or grid file ? Or I am doing or interpreting something wrong ?
I am attaching the ncdisp output from my his.nc file for your reference.
Kind regards
-Neel
- Attachments
-
- ncdisp output.txt
- (35.01 KiB) Downloaded 1663 times
Re: roms_matlab plotting and analysis routines
I assume you have tested other options, like plotting different variables than 'u', specifying time as an index instead of a date string, plotting at constant vertical index (instead of z) using roms_sview? Does that tell us anything?
Where you are getting the error, Matlab is finding the index of the z-levels that bracket the -1 m depth you request.
Depth -1 m is shallow and might be less than the depth of the center of the surface cell if your vertical resolution is coarse, but at this point in the code the array it is slicing has already been padded with zeros to ensure that there is a point to complete the interpolation.
You will have to debug this in Matlab. Set a debug break point in roms_zslice_var.m ...
>> dbstop in roms_zslice_var
The run roms_zslice.
Check the inputs to roms_zslice_var in the Matlab command window, in particular size(data) and size(grd.z_u). They should match, and in your case I think they should be [15 50 99] though I could be off by 1. Then step your way down to row 82 where you got the error. Now data should have the vertical coordinate padded and have been be rearranged into a 2-D ribbon of size [N+2 xi_u*xi_eta] so for you [17 4950]. Check everything that's going on in the code there to figure out why you get that error.
By the way, the tiddlywiki page is a bit out of date, but the instructions you quote are still correct. I maintain this code now on github at
https://github.com/johnwilkin/roms_wilkin
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: roms_matlab plotting and analysis routines
Yes, I did test some other variables like ubar in roms_zview but I believe it's a 2D parameter therefore having depth was no sense there and MATLAB plotted the results anyways. Yes, the roms_sview worked fine with date input as a string.
I followed your debugging suggestion. It seems that my data attribute has a dimension 17x4950 and my error causing parameter zg_ind has a dimension of 6202x1. May be that's why the indexing error might occur. But I am sure what might be causing these varied dimensions ?
Rest all parameters look pretty fine as per what you had suggested like z attribute was of the size 17x4950 and z_r attribute was 15x50x100.
Attaching the workspace values for reference.
Kind regards
-Neel
- Attachments
-
- workspace details during debug
- Screenshot 2021-04-01 190344.jpg (49.89 KiB) Viewed 1901287 times
Re: roms_matlab plotting and analysis routines
Is it up to date?
Maybe send a small version of your output file for me to look at. Not all 172 records. Just a couple.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: roms_matlab plotting and analysis routines
Earlier I'd been using the version I had downloaded via svn though I hadn't changes anything in that and ran it command line just. And I am sorry I didn't read the part in one of your previous posts mentioning that now you maintain it in your git repository. I was more focused on the debugging checks that you had suggested. So I downloaded the git version and tried if i were any successful but alas! no. The same problem seems to persist and the debug produced pretty similar results like the earlier one.
I failed to understand the part where you said " Maybe send a small version of your output file for me to look at. Not all 172 records. Just a couple." By output file you meant the history .nc file I believe. I am attaching it for your reference. It has only output for an hour of simulation.
Kind regards
-Neel
- Attachments
-
- Lombok_roms_his.nc
- output his.nc file
- (14.3 MiB) Downloaded 1665 times
Re: roms_matlab plotting and analysis routines
roms_zslice_var uses the tests:
Code: Select all
zg_ind = find(diff(z<depth)~=0);
Code: Select all
zl_ind = find(diff(z>depth)~=0);
With a non-monotonic z coordinate these are multivalued and the resulting index vectors exceed the dimension of the grid.
I can't believe no one has ever struck this problem before. I thought my code was robust to h < 0 in the land mask. In fact, I'm sure I've worked successfully with such girds before.
I don't have the time to check, but it may be that you have very large negative h values, and a very strongly stretched coordinate (theta_s = 8, theta_b = 4), and this combination is perhaps producing the non-monotonic z coordinate.
I suggest you modify your grid file to make h in the land mask some benign small positive value. It will make no difference to the ROMS solution.
Meanwhile, I'll think of what logic I need to add to trap this case.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
If you update from github https://github.com/johnwilkin/roms_wilkin you should be able to plot from the output files you already have.
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: roms_matlab plotting and analysis routines
I updated the code from GitHub and it works just fine. Again another thing I wanted to confirm is that the documentation of these routines is the same as the one in TiddlyWiki right?
Again thanks for providing the plot package. It's super easy to use and user friendly
Kind regards
-Neel
Re: roms_matlab plotting and analysis routines
I use some packages for plotting and can see the history file. But, honestly, I have problems with your package !
For a few days, I am working on it but I can't use it, and all of the time the error is
g=roms_get_grid(file,file);
You need to add stretching.m to your matlab path
Error using roms_get_grid (line 65)
from e.g. https://www.myroms.org/svn/src/matlab/utility
Your explanation is here http://romsmatlab.tiddlyspot.com/ but I cannot solve the problems. Here I try to explain more about that!
initially, I have put svn checkout https://www.myroms.org/svn/om/matlab/roms_wilkin in my terminal.
I have downloaded and seen your folder in my system. Then, in your folder, I have put this command to my terminal to download John Evans' snctool;
svn co svn://svn.code.sf.net/p/mexcdf/svn/mexnc/trunk ./mexcdf/mexnc
svn co svn://svn.code.sf.net/p/mexcdf/svn/snctools/trunk ./mexcdf/snctools
Hence,
After that, I add your name folder(also two mexnc and snctools) in my path like this figure.
For plotting; I put my history file roms_his.nc in your folder and follow this command:
file='roms_his.nc'
g=roms_get_grid(file,file);
I have tested many methods but I cannot use your codes. I download your https://github.com/johnwilkin/roms_wilkin
But, my problem is not solved. I use Matlab 2014a and 2020 a. I have both versions too!
Do you have any suggestions?
Re: roms_matlab plotting and analysis routines
My codes, much updated since 2010, are now on GitHub at https://github.com/johnwilkin/roms_wilkin. Please clone that repo to use roms_wilkin tools.
I have changed the code to use the native Matlab interface to netcdf, so Evans' snctools are not required.
The specific error you are getting at the start ...
... indicates that I use the s-coordinate stretching function (stretching.m) that is part of the Matlab toolset distributed at myroms.org (same place you get your ROMS code). I do this, rather than keep a copy of stretching.m in roms_wilkin, so that when new coordinate definitions are added my code doesn't fall out of date. There are other functions in myroms.org Matlab that I make use of.g=roms_get_grid(file,file);
You need to add stretching.m to your matlab path
Error using roms_get_grid (line 65)
from e.g. https://www.myroms.org/svn/src/matlab/utility
So, just as the error says, You need to add stretching.m to your matlab path
I recommend you download all the Matlab tools from https://www.myroms.org/svn/src/matlab using svn, browse what's there (lots of useful things) and add to your matlabpath the things you are likely to make use of (definitely the utility folder, and probably more).
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
Thanks!
I guess that I have solved the problems of installation with your suggestions!
However, I cannot use it! For example,
file =
'E:\roms_his.nc'
>> grd=roms_get_grid(file,file);
I will face:
Error using ncread
Too many input arguments.
Error in roms_zslice (line 56)
t = ncread(file,time_variable,time,1);
Error in roms_zview (line 174)
data = roms_zslice(file,var,time,depth,grd);
Here is all information when using this command.
I have read this post and you mention angle and h(sign). I put some information about that!
- Attachments
-
- log.matlab.txt
- (3.78 KiB) Downloaded 1700 times
-
- GRID INFO.txt
- (704 Bytes) Downloaded 1621 times
Re: roms_matlab plotting and analysis routines
You are not getting the ncread that is the native Matlab netcdf interface.
In Matlab try ...
>> which ncread -all
You should see something like ...
Code: Select all
>> which ncread -all
/Applications/MATLAB_R2020b.app/toolbox/matlab/imagesci/ncread.m
>>
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
I'm using the roms_wilkin tools, that I've cloned with git from https://github.com/johnwilkin/roms_wilkin.git, but I'm getting several errors related to unrecognised functions/variables. The latest was:
Code: Select all
Unrecognized function or variable 'nc_global'.
Error in roms_cpplist (line 11)
cpp = nc_attget(file,nc_global,'CPP_options');
Error in post_process_ROMS_1D (line 70)
romsCPP = roms_cpplist([lower(MyAppCPP) '.h']);
I had the same error with 'nc_isvar' (unrecognised).
I'm using Matlab version '9.8.0.1417392 (R2020a) Update 4'.
Any help would be greatly appreciated.
Cheers,
Joao
Re: roms_matlab plotting and analysis routines
The first line just needs to be:
Code: Select all
cpp = ncreadatt(file,'/','CPP_options');
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: roms_matlab plotting and analysis routines
(there was also an error in my code that was calling the CPP header file and not the history file)
Re: roms_matlab plotting and analysis routines
I'm a new user of Matlab and ROMS model. Can you kindly help me how to print the image of roms_zview command?
Which command I can do to plot with specific area?
Thank you very much!
Re: roms_matlab plotting and analysis routines
https://www.mathworks.com/learn/tutoria ... nramp.html
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu