How to create the hycom_time with the real-time data

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
manhnt181
Posts: 33
Joined: Wed Feb 03, 2021 5:07 pm
Location: Institute of Geophysics

How to create the hycom_time with the real-time data

#1 Unread post by manhnt181 »

Hi everyone,
I'm practicing create the Clim condition for ROMS model by using the real-time data from https://tds.hycom.org/thredds/catalog/G ... _93.0/FMRC.
However, when I displayed the time values in this url, it showed that this values ranged from 120 to 300. How can I do to create the hycom_time variable which was similar to this value with the data from this url (https://tds.hycom.org/thredds/catalogs/GLBa0.08).
Thank all. I really appreciated that.

jcwarner
Posts: 1172
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: How to create the hycom_time with the real-time data

#2 Unread post by jcwarner »

for example here
https://tds.hycom.org/thredds/dodsC/GLB ... 0:00Z.html

the variable list will show for time:
units: hours since 2022-04-30 12:00:00.000 UTC

so the 120 is hours since that time.
You need to look for these attributes on the data set that you are looking at.

you can also do something like
loc='https://thredds.ucar.edu/thredds/dodsC/ ... p5deg/Best';
gfs_hours=ncread(loc,'time');
time_att=ncreadatt(loc,'time','units');
time_start=datenum(str2num(time_att(12:15)),str2num(time_att(17:18)),str2num(time_att(20:21)),str2num(time_att(23:24)),str2num(time_att(26:27)),str2num(time_att(29:30)));
gfs_time=time_start+gfs_hours/24;

manhnt181
Posts: 33
Joined: Wed Feb 03, 2021 5:07 pm
Location: Institute of Geophysics

Re: How to create the hycom_time with the real-time data

#3 Unread post by manhnt181 »

Hi Dr. John,
Thank you very much for your suggestion. I can learn a little bit from the data.
I've been practicing the hycom data in the url (https://tds.hycom.org/thredds/dodsC/GLB ... /FMRC/runs). However, I got the problem when interpoting the u values into the grid. This error was like that:

Code: Select all

Error using griddedInterpolant
GridVectors must define a grid whose size is compatible with the Values array.

Error in interp2>makegriddedinterp (line 226)
    F = griddedInterpolant(varargin{:});

Error in interp2 (line 134)
        F = makegriddedinterp(X, Y, V, method,extrap);

Error in roms_from_stdlev_mw (line 276)
        roms(:,i,:) = interp2(xa,za,data,x,z,'spline');

Error in updatclim_coawst_mw_12b_hycom_modif (line 92)
  u=roms_from_stdlev_mw(gn.lon_rho,gn.lat_rho,clm.z,clm.tmp,gn,'u',0);
This is a program controlling the interpolating process:

Code: Select all

disp(['interpolating for ' datestr(hycom_time(sindex))]);
tz_levs=length(hycom_depth);

  disp('interpolating u');
  level=1;
  for k=level:tz_levs
    tmp=ncread(hycom_url,'water_u',[hlons hlats k sindex],[ [hlone-hlons+1] [hlate-hlats+1] 1 1]);
    disp(['doing griddata u for level ' num2str(k) ' of ' num2str(tz_levs) ' at ' datestr(now)]);

    clm.tmp(level,:,:)=tmp;
    level=level+1;
  end
    %== Vertical interpolation (t,s,u,v) from standard z-level to s-level
% clm.v(clm.v<-2)=-2; clm.v(clm.v>2)=2;
  u=roms_from_stdlev_mw(gn.lon_rho,gn.lat_rho,clm.z,clm.tmp,gn,'u',0);
  save u.mat u
  clear u;
Can you kindly help me to address this problem?
Thank you very much!

jcwarner
Posts: 1172
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: How to create the hycom_time with the real-time data

#4 Unread post by jcwarner »

it is not possible for me to tell what is going on. The issue is with the array sizes. You will need to put in break points, see what the arrays are, the sizes, the values, and follow the arrays as they are passed to each routine. it is not that hard, just put in break points. when matlab stops at those lines, you can just pcolor each variable and see what they contain, and their sizes.

manhnt181
Posts: 33
Joined: Wed Feb 03, 2021 5:07 pm
Location: Institute of Geophysics

Re: How to create the hycom_time with the real-time data

#5 Unread post by manhnt181 »

Hi Dr. John,
I had displayed the sizes of hlon, hlat, tmp variables after interpolating like this:
hlon= 4500 1
hlat=4251 1
tmp= 40 4500 4251
however I got the error:

Code: Select all

Error using griddedInterpolant
The grid vectors do not define a grid of points that match the given values.

Error in interp2>makegriddedinterp (line 228)
    F = griddedInterpolant(varargin{:});

Error in interp2 (line 136)
        F = makegriddedinterp(X, Y, V, method,extrap);

Error in roms_from_stdlev_mw (line 276)
        roms(:,i,:) = interp2(xa,za,data,x,z,'spline');
Can you kindly give me any suggestions to fix it?

Post Reply