i use coawst model, the his file is scs_1_his.nc and the bdy file is scs_1_his.bdy. The begin date is 2012-10-28 00:00:00
(1) problem of roms_zview
the code as folows:
file = 'scs_1_his.nc';
var = 'umag'; % vec_d is not equal to 0
time = 1;
depth = -5;
grd = roms_get_grid(file, file);
vec_d = 3;
uscale = 1;
varargin = 'k';
[theData, theGrid, theHan] = roms_zview(file, var, time, depth, grd, vec_d, uscale, varargin);
you can find the time in the fig is "13-Dec-0154 00:00:00"
when i set "time = '28-Oct-2012 01:00:00';", the error as follows:
Requested date 28-Oct-2012 01:00:00 is not between the dates in
scs_1_his.nc which are 13-Dec-0154 00:00:00 to
15-Dec-0154 00:00:00
Error in roms_zview (line 54)
if nargin == 0
Output argument "thegrid" (and maybe others) not
assigned during call to
"/home/limaolin/model/COAWST_140823/Projects_My/general_soft/roms_wilkin/roms_zview.m>roms_zview".
(2)problem of roms_bview
the code as follows:
file = 'scs_1_bdy.nc';
var = 'temp_north';
time = 2;
bndy = 'north';
grd = roms_get_grid(file, file);
xcoord = 'lon';
[theData,theHan] = roms_bview(file,var,time,bndy,grd,xcoord);
errors as follows
Error using netcdflib
The NetCDF library encountered an error during
execution of 'inqVarID' function - 'Variable not
found (NC_ENOTVAR)'.
Error in netcdf.inqVarID (line 22)
varid = netcdflib('inqVarID', ncid, varname);
Error in nc_varget_tmw>varget (line 62)
varid=netcdf.inqVarID(gid,varname);
Error in nc_varget_tmw>varget_nc (line 24)
[data,info] = varget(ncid,varname,varargin{:});
Error in nc_varget_tmw (line 5)
[data,info] =
varget_nc(ncfile,varname,varargin{:});
Error in nc_vargetr (line 38)
[data,info] =
nc_varget_tmw(ncfile,varname,varargin{:});
Error in nc_varget (line 35)
[data,info] = nc_vargetr(ncfile,varname,varargin{:});
Error in roms_get_grid (line 90)
grd.(vname) = squeeze(...
how to use roms_bview
(3)probles of roms_quivergrd
file = 'scs_1_his.nc';
var = 'u';
time = 1;
depth = -5;
grd = roms_get_grid(file, file);
vec_d = 3;
uscale = 1;
varargin = 'k';
[theData, theGrid, theHan] = roms_addvect(file, var, time, depth, grd, vec_d, uscale, varargin);
there is no picture in the fig, but when i comment the code as follows in the roms_quivergrd, there is the picture
% % if 1
% % ax = axis;
% % clip = find(x<ax(1)|x>ax(2)|y<ax(3)|y>ax(4));
% % %clip = findoutrange([x y],ax);
% % x(clip) = NaN;
% % end
problem of roms_zview roms_bview and roms_quivergrd
problem of roms_zview roms_bview and roms_quivergrd
- Attachments
-
- addvect.png (23.35 KiB) Viewed 5201 times
-
- umag.png (74.97 KiB) Viewed 5201 times
Re: problem of roms_zview roms_bview and roms_quivergrd
1)
The fact that it finds 13-Dec-0154 00:00:00 suggests that roms_get_date doesn't find the right basedate in the time units attribute of your his file.
Check if the units attribute of ocean_time in your his file is ocean_time:units = "seconds since 1858-11-17 00:00:00" ;. This is what you would expect if you create clm/bdy files with roms_master_climatology and set TIME_REF = 18581117.00 ! yyyymmdd.dd in your ocean.in file.
I expect you to find ocean_time:units = "seconds since 0001-01-01 00:00:00" ;.
2)
roms_get_grid can't get the grid information it needs from your bdy file ...
This should work:
3)
roms_addvect is supposed to add a vector plot to an existing plot. If you don't have a figure open before using roms_addvect the axis variable is not set and will by default be ' 0 1 0 1'. Hence roms_quivergrd will remove all vectors outside 0<x<1 and 0<y<1 and your plot will be empty.
Because roms_zview can't find the requested date in your his file, it can't produce the output arguments.Requested date 28-Oct-2012 01:00:00 is not between the dates in
scs_1_his.nc which are 13-Dec-0154 00:00:00 to
15-Dec-0154 00:00:00
Error in roms_zview (line 54)
if nargin == 0
Output argument "thegrid" (and maybe others) not
assigned during call to
"/home/limaolin/model/COAWST_140823/Projects_My/general_soft/roms_wilkin/roms_zview.m>roms_zview".
The fact that it finds 13-Dec-0154 00:00:00 suggests that roms_get_date doesn't find the right basedate in the time units attribute of your his file.
Check if the units attribute of ocean_time in your his file is ocean_time:units = "seconds since 1858-11-17 00:00:00" ;. This is what you would expect if you create clm/bdy files with roms_master_climatology and set TIME_REF = 18581117.00 ! yyyymmdd.dd in your ocean.in file.
I expect you to find ocean_time:units = "seconds since 0001-01-01 00:00:00" ;.
2)
roms_get_grid can't get the grid information it needs from your bdy file ...
Code: Select all
% Gets the lon,lat,mask,depth [and z coordinates] from roms netcdf
% grd_file or output file
Code: Select all
file = 'scs_1_bdy.nc';
file2 = 'scs_1_his.nc';
var = 'temp_north';
time = 2;
bndy = 'north';
grd = roms_get_grid(file2, file2);
xcoord = 'lon';
[theData,theHan] = roms_bview(file,var,time,bndy,grd,xcoord);
roms_addvect is supposed to add a vector plot to an existing plot. If you don't have a figure open before using roms_addvect the axis variable is not set and will by default be ' 0 1 0 1'. Hence roms_quivergrd will remove all vectors outside 0<x<1 and 0<y<1 and your plot will be empty.
Re: problem of roms_zview roms_bview and roms_quivergrd
thanks for your help to solve the problems of 1 and 3 correctely. But the problem of 2 is not solved, the errors as follows:
Undefined function or variable "dnum".
Error in roms_bview (line 119)
Data.dnum = dnum;
another problem is for roms_zview and roms_sview, I have set the time for 1 and 2 to draw umag and temp, you can find the min and max value of figs of time = 2, why did this happen and how to solve the problem.
Undefined function or variable "dnum".
Error in roms_bview (line 119)
Data.dnum = dnum;
another problem is for roms_zview and roms_sview, I have set the time for 1 and 2 to draw umag and temp, you can find the min and max value of figs of time = 2, why did this happen and how to solve the problem.
- Attachments
-
- time = 2, sview
- time_2_umat_sview.png (28.69 KiB) Viewed 5112 times
-
- time = 1, sview
- time_1_umat_sview.png (56.47 KiB) Viewed 5112 times
-
- time = 2, zview
- time_2_umat_zview.png (44.19 KiB) Viewed 5112 times
-
- time = 1, zview
- time_1_umat_zview.png (72.19 KiB) Viewed 5112 times
Re: problem of roms_zview roms_bview and roms_quivergrd
You have that error regarding dnum because it is unassigned at line 119.
roms_bview would actually have also given you the following warning:
"Problem parsing date from (name of your boundary file) for time index (the requested time index)"
This is your clue that your boundary file does not have a time coordinate that roms_get_date.m can process. This could be because the time variable is not 'ocean_time', 'time', or 'bry_time', or that these have units attributes that cannot be parsed into a date.
If you can't easily fix the boundary file, you can patch over this problem by adding a bit of code at line 107:
The other problems your plots show is that your model is blowing up in the eastern Sulu Sea. You have extreme velocities through the whole water column because they reach 10 m/s at z = 1 m depth below surface (in the roms_zview plot) and also at the seafloor (level = 1 in the roms_sview plot).
That is an issue with your bathymetry, land/sea mask, or simply that your model time step DT is not small enough for the intense currents that occur in the irregular topography of the Philippine Archipelago. You'll have to sort that our for yourself.
roms_bview would actually have also given you the following warning:
"Problem parsing date from (name of your boundary file) for time index (the requested time index)"
This is your clue that your boundary file does not have a time coordinate that roms_get_date.m can process. This could be because the time variable is not 'ocean_time', 'time', or 'bry_time', or that these have units attributes that cannot be parsed into a date.
If you can't easily fix the boundary file, you can patch over this problem by adding a bit of code at line 107:
Code: Select all
catch
warning([ 'Problem parsing date from file ' file ' for time index ' time])
dnum = NaN;
tstr = ' - Date unknown';
end
That is an issue with your bathymetry, land/sea mask, or simply that your model time step DT is not small enough for the intense currents that occur in the irregular topography of the Philippine Archipelago. You'll have to sort that our for yourself.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu