Dear Wilkin and rouf
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 = 'ocean_his.nc';
g=roms_get_grid(file,file);
g will not return any value, and the errors are:
Code:
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
I use the latest version of the roms_wilkin matlab tools form
https://www.myroms.org/svn/om/matlab/roms_wilkin, The Revision 372,and my roms's version is 3.0. I ensured ocean_his.nc is in right path, also found by using ncdump command that my ocean_his.nc has no mask_rho, mask_psi, mask_u, mask_v and angle information,the grid maybe specified in ana_grid. I didn’t modify anything In terms of running upwelling test case in ROMS.
Code:
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," ;
the logfile:
Code:
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
rouf said he masked error then he continued to follow your commands, but how to mask the error?
What should I do to solve the errors?