some troubles with the grid file

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
slvester
Posts: 32
Joined: Mon Jun 01, 2009 12:59 pm
Location: second institution of oceanography,state oceanic administration China

some troubles with the grid file

#1 Unread post by slvester »

Hello everyone ,when I follow the ROMS Tutorials (http://eros.eas.gatech.edu/ROMS-Tutorial/tutorials.html)(thanks for this tutorials)to se up my own grid file(the northwest pacific ocean:105°-179°E,9.6°-47.8°N),follow the MAIN_grid.m
%=========================================================
% Preparing the grid param
%==========================================================

% EDIT: set a name to recognize the grid
nameit='nwpacific'; % 50 km grid

% EDIT: set path where you want to store the grid.
outdir='/dcfs2/users/slvester/roms/roms-grid/';
if ~exist(outdir), unix(['mkdir ',outdir]);end
grdfile=[outdir,nameit,'-grid.nc'];

% EDIT: insert detailed coastline file if wanted. You can extract it
% form the web at: rimmer.ngdc.noaa.gov/coast
% After you donwload the file use ConvertCstdat2mat.m
% otherwise use default. The format is lon,lat in the mat file.
seagridCoastline=which('rgrd_CoastlineWorld.mat'); % default centered on Atlantic/Indian
seagridCoastline=which('rgrd_CoastlineWorldPacific.mat'); % default centered on Pacific


rgrd_DrawCstLine(seagridCoastline);


% select for 100*150 for the norhtwestern pacific ocean
% zoom in the picture to approximately select the location of
% your final grid.
[Lons]=get(gca,'xlim');
LonMin=Lons(1); LonMax=Lons(2);
[Lats]=get(gca,'ylim');
LatMin=Lats(1); LatMax=Lats(2);
close

% EDIT: set ax= [LonMin, LonMax, LatMin, LatMax]
% so that you include the location of the grid your
% are building

ax= [LonMin, LonMax, LatMin, LatMax]


% EDIT: put the name of the file in which the scirpt will
% save the 4 corners of your grid in LON,LAT .
CornerFile= [outdir,'GridCorners-',nameit,'.dat'];

% yu have two options to generate the corners of the grid:
% OPT: 1
% If your corner are the one in ax then just write the
% corner file. WriteCornerFileFromAX.m
rgrd_WriteCornerFileFromAX(ax,CornerFile);

% OPT: 2
% IF you already have a corner file than skip the FindGridCorners
% use this routine to design grid if needed. FindGridCorners.m
rgrd_FindGridCorners (ax,seagridCoastline,CornerFile);
close all



% Plot grid
rgrd_PlotGridCorners(ax,CornerFile,seagridCoastline);

% Find the distance and needed reolution for the grid.
% TellMeCornerDist.m
[x_spacing,y_spacing]=rgrd_TellMeCornerDist(CornerFile);
% remember these spacing, round them to be even.
disp('You need to set these in Seagrid');
Cells_Edge_1 = round(y_spacing/2)*2
Cells_Edge_2 = round(x_spacing/2)*2

% selected 94*80 for northwestern pacific ocean
%==========================================================
% Build grid - Running Seagrid
%==========================================================
% Seagrid will be used only to generate the curv. grid
% nothing else, no bath, no masking here.
% execute seagrid and prepare grid
% in seagrid just
% 1) load the coastline file and the boundary file
% 2) set the spacing in setup using Cells_Edge_1, Cells_Edge_2
% 3) On the menu compute select "Set all water"
% 4) then save the seagrid.mat file and exit.
seagrid(seagridCoastline)
% if you like you can also load the topography and use the
% mask computation options. I prefer taking care of this later
% in this script. It is up to you.

% convert seagrid file to ROMS grid
seagrid2roms('seagrid.mat', grdfile);

% EDIT add new grid in the rnt_gridinfo.m
configfile=which('rnt_gridinfo');
unix(['vi ',configfile]);
grd=rnt_gridload(nameit);
---------------------------------------
then I go on work in matlab
>>seagrid2roms('seagrid.mat', grdfile);(the seagrid.mat here don't iclude the computation land mask)
>> grd=grd=rnt_gridload(nameit)
grd=
id :'nwpacific'
name:'northwestern pacific'
grdfile:'/dcfs2/users/roms/roms-grid/nwpacific-grid.nc'
N:30
thetas:5
thetab:4.0000000000000000e-01
tcline:200
cstfile:[1*74char]
hc:30
lonr:[136*86]
...........
---------------------------------------
>>rnt_plcm(1./grd.pm/1000,grd)
but the figure is so strange,it do no include the coastline,just have the longitude and latitude and color,where is the coastline?

I am sorry ,I don't konw how to attach the matlab figure in here.then I comeback to compute the land mask and saved(seagrid.mat),and:
>>seagrid2roms('seagrid.mat', grdfile);
>>grd=rnt_gridload(nameit);
>>rnt_plcm(1./grd.pm/1000,grd)
the figure is something different with the first one ,the coastline is also not in the figure ,but it is just with the shape (outline in white).how can I resolve it?
I am sorry for my poor English
Thank you!

slvester
Posts: 32
Joined: Mon Jun 01, 2009 12:59 pm
Location: second institution of oceanography,state oceanic administration China

Re: some troubles with the grid file

#2 Unread post by slvester »

Thanks ,now i konw how to resolve this trouble,in file:rnt/rnt_gridinfo.m ,I add
gridindo.cstfile=which('World_coast.mat')to that m file.
World_coast.mat is the world coast file I have set up;
Then :
>>rnt_plcm(.1/grd.pm/1000,grd)
the figure have the coast line
thanks !

Post Reply