Problems in using Arango 's matlab scripts
Problems in using Arango 's matlab scripts
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(:,end1));colorbar;
% contour(rvalue(h(:,end1)));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(:,end1)));colorbar;
%contour(hout(:,end1));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. 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?
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.
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(:,end1));colorbar;
% contour(rvalue(h(:,end1)));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(:,end1)));colorbar;
%contour(hout(:,end1));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. 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?
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.
Re: Problems in using Arango 's matlab scripts
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
2. No, interpolation forcing files to ROMS grid is not necessary. ROMS will do it internally.
--Shi-Ming
Re: Problems in using Arango 's matlab scripts
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?
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?
Re: Problems in using Arango 's matlab scripts
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.
Sorry, can't answer about the Matlab stuff vs. hdat or whatever.
Re: Problems in using Arango 's matlab scripts
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?
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?
Re: Problems in using Arango 's matlab scripts
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.
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.
Re: Problems in using Arango 's matlab scripts
[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?
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?
Re: Problems in using Arango 's matlab scripts
No, ROMS does not read the coast variable - that's just for plotting codes.
Re: Problems in using Arango 's matlab scripts
Got it, Thank you very much!kate wrote:No, ROMS does not read the coast variable - that's just for plotting codes.