Problems in using Arango 's matlab scripts

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
rockymt
Posts: 5
Joined: Tue Sep 22, 2015 3:09 pm
Location: Ludong University

Problems in using Arango 's matlab scripts

#1 Unread post by rockymt »

Hi. I'm a new learner of roms. I used to prepare the gird files etc. with "ROMSTOOLS" which belong to ROMS_AGRIF version before. But I want to turn to Rutgers version because it can deal with sea ice problem. But it is difficult for me to prepare the grid, forcing, boundary and initial files. I knew Arango 's matlab scripts in " http://www.myroms.org/wiki/Matlab_Scripts " will help, but I did not find a general tutorial to follow like ROMSTOOLS Documentation ("http://www.romsagrif.org/index.php/docu ... oc8886_3_9 "). So I am very confused to use these tools.

I guess the procedure maybe similar with ROMSTOOLS such as "grid --->forcing--->climatology--->initial condition and boundary". I tried to realize the Benguela example in ROMSTOOLS Documentation with the Arango 's matlab scripts.
A lot of problems appeared when I prepared the grid and making force files.
1.
When preparing the grid file, I write the script like this:
%---------make_grid-----------------

% edit extract_coast_XXX.m
extract_coast_Benguela
% edit extract_bath_XXX.m
extract_bath_Benguela
% edit boundary.dat
seagrid
nameit = 'Benguela';
grdfile=[nameit,'-grid.nc']
seagrid2roms('seagrid.mat',grdfile);

hmin = 75;
hmax = 5000;
h = nc_read(grdfile, 'h');
% contour(h(:,end:-1:1));colorbar;
% contour(rvalue(h(:,end:-1:1)));colorbar;

rmask = nc_read(grdfile, 'mask_rho');
h( h<hmin) = hmin;
h( h>hmax) = hmax;

[hout]=smooth_bath(h,rmask,4,0.35,50);
%contour(rvalue(hout(:,end:-1:1)));colorbar;
%contour(hout(:,end:-1:1));colorbar;
ncwrite(grdfile,'hraw',h);
nc_write(grdfile,'h',hout);

coastfile='Benguela_coast.mat';
editmask(grdfile, coastfile);

%---------end--------------------------

But I find the bathymetry and mask turn right for 90 degree. It seems seagrid2roms does not work correctly. I also wonder whether the script " c_grid .m" will prepare the grid and whether it can interpolate the bathymetry on the grid.
BaiduShurufa_2016-3-20_11-3-24.png
BaiduShurufa_2016-3-20_11-3-24.png (69.18 KiB) Viewed 9240 times
2.
I followed the "d_ecmwf2roms.m" to prepare the forcing files. But I found the variables like 'sustr', 'svstr', 'shflux' , 'shflux' etc. were not interpolated on the grid. That is to say, the grid of forcing files and grid file do not match. Should I add an interpolate procedure after this? How?
BaiduShurufa_2016-3-20_11-3-57.png
BaiduShurufa_2016-3-20_11-3-57.png (51.68 KiB) Viewed 9240 times

I will appreciate if anyone who can answer me or if tell me where I can find a more detailed document for Arango 's scripts.
Sorry for my poor English. I am not a native speaker. Thank you guys.

smchen
Posts: 12
Joined: Sat Mar 21, 2015 12:38 am
Location: TORI, Taiwan

Re: Problems in using Arango 's matlab scripts

#2 Unread post by smchen »

1. I am not sure what causes your problem, but I notice that you use both ncwrite and nc_write. Is it a typo? The Matlab native function "ncwrite" and the other function "nc_write" of snctools use different ordering of array indexes, which results in 90 degree turning. This may not resolve your problem, but this is what appears in my mind when seeing 90 degree.

2. No, interpolation forcing files to ROMS grid is not necessary. ROMS will do it internally.

--Shi-Ming

rockymt
Posts: 5
Joined: Tue Sep 22, 2015 3:09 pm
Location: Ludong University

Re: Problems in using Arango 's matlab scripts

#3 Unread post by rockymt »

Hi Shi-Ming,
Many thanks for your suggestions.
I found another main reason of the right turning of grid is I did not notice that the first point of boundary.dat file read by seagrid must be in up-left corner. I have changed the rearrangement from

8.0 -38.0 1
22.0 -38.0 1
22.0 -26.0 1
8.0 -26.0 1

to

8.0 -26.0 1
8.0 -38.0 1
22.0 -38.0 1
22.0 -26.0 1

I also replaced ncwrite to nc_write. Now, everything for grid goes right.

I have no experience of simulation with different grids of forcing and bathymetry. I always thought that all files must keep the same girds and it is what they did in the example case "DAMEE_4". Maybe I will try different grids later. I also wonder whether interpolation is also not necessary for the climatology and initial files.

Now I am trying to understand how to prepare the climatology and initial files. In " d_climatology.m" file, some "OA" files generated by an old fortran program are needed. But I found strange posts about this in the forum:
viewtopic.php?f=14&t=1764&p=10886&hilit=oa#p10886
viewtopic.php?f=14&t=2876&p=10807&hilit=oa#p10807
Kate said OA is very old and suggested using pyroms for climatology and initial files.
I have several questions:
Is there any simple way to generate the "OA" file in matlab? I feel it is too difficult for me to understand an old fortran code and hdat format. How does the Matlab community prepare the "OA" files for roms of Rutgers version?
Is it possible to use Arango 's matlab scripts to generate climatology and initial conditions from SODA?
Should I turn to pyroms?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Problems in using Arango 's matlab scripts

#4 Unread post by kate »

ROMS will only interpolate forcing files of a certain format. You have to interpolate your own initial and climatology files. The DAMEE example predates the internal interpolations.

Sorry, can't answer about the Matlab stuff vs. hdat or whatever.

lindandan
Posts: 17
Joined: Tue Nov 03, 2015 12:52 am
Location: School of Space Science of USTC

Re: Problems in using Arango 's matlab scripts

#5 Unread post by lindandan »

Hi. I'm a new learner of roms,too. Could you help me?
I found that you have used to prepare the gird files with "ROMSTOOLS" which belong to ROMS_AGRIF version to run some application of Rutgers version. So I have some question. In the ROMSTOOLS of ROMS_AGRIF version, there is no parameter "Vstretching" and "TCLINE" to set when generate the grid file.Does it matter? How to set the two parameters in the file ocean.in to match the grid file?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Problems in using Arango 's matlab scripts

#6 Unread post by kate »

The grid file only has horizontal information in it - ROMS won't try to read Vstretching from it.

Whatever tools are used to create fields with vertical information, such as initial/boundary conditions will have to use values consistent with your ocean.in.

lindandan
Posts: 17
Joined: Tue Nov 03, 2015 12:52 am
Location: School of Space Science of USTC

Re: Problems in using Arango 's matlab scripts

#7 Unread post by lindandan »

[quote="kate"]The grid file only has horizontal information in it - ROMS won't try to read Vstretching from it.

Own, I have found that with the grid file of WC13/Data/wc13_grd.nc. Thank you. Another qusetion: in the grid file generated using the ROMSTOOLS, there is no variable "coast". Whether it's necessary to add the xoast data to the grid file, whether it's useful when running the ROMS of Rutgers?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Problems in using Arango 's matlab scripts

#8 Unread post by kate »

No, ROMS does not read the coast variable - that's just for plotting codes.

lindandan
Posts: 17
Joined: Tue Nov 03, 2015 12:52 am
Location: School of Space Science of USTC

Re: Problems in using Arango 's matlab scripts

#9 Unread post by lindandan »

kate wrote:No, ROMS does not read the coast variable - that's just for plotting codes.
Got it, Thank you very much!

Post Reply