## SEAGRID use

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Message
Author
perezro

### SEAGRID use

Hello all,
I apologize if my questions are far to simple but still difficult for me, and i will appreciate a lot your help.
I am having problems getting the coastline.... when I use fillseg it get some trouble in the intersections or country boundaries and the actual coast... I can not figure out how to manipulate the data in order to get things straight, I need to add three or four points that make the coast line connect following the corners of the plotting area (instead connect through my area of interest).
And second, When I try to export the data using seagrid2roms it said:
> In seagrid2roms at 50
??? Reference non-existent field "s"
Error in ==> seagrids2roms at 61
s = the seagridData.s

rsignell
Posts: 123
Joined: Fri Apr 25, 2003 9:22 pm
Location: USGS

### Re: SEAGRID use

If you have used the "join_cst" Matlab routine to make your coastline segments continuous, you will find them sorted from longest piece to shortest piece separated by a row containing NaN values. Unless you have an unusual coastline, it's normal that you have to add a few points to your first segments or first few segments to get the polygons to close properly (so that when you do "fillseg(coast)" you see that it fills only land.

Here's a simple example. Say you have a 5 point coastline with land on the left and water on the right.

Code: Select all

``````lon=[   5.9319    4.3772    6.8474    4.9472    5.7764];
lat=[   9.2445    7.4051    5.2372    3.3759    1.7555];``````
If you just do fillseg([lon(:) lat(:)]), you connect the ends and get an undesirable result.

But if you add two points to the beginning of the segment:

Code: Select all

``````coast=[2 min(y(:)); 2 max(y(:)); lon(:) lat(:)];
fillseg(coast); ``````
you get the desired result.

perezro

### Re: SEAGRID use

Thanks Mr. Signell,
The problem is that in the gulf of Finland, were I am currently working, I need to create two points at the beginning and on at the end of more than one segment, and look for the NaN limits is not easy (maybe I do not know and there is a command that does so...) so at the end i get It right (more or less) but I suffer quite a bit....

Does anyother figure out about the problem with seagrid2roms??

Regards: R

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

### Re: SEAGRID use

Using join_cst.m and adding the two points far inland of your coast at the beginning and the end of your coastline should work as Mr. Signell suggested. Have you tried it?

mariafattorini
Posts: 52
Joined: Tue Mar 03, 2009 2:39 pm
Location: C.N.R. - LaMMA

### Re: SEAGRID use

Hello all,

I too have a problem with Seagrid use.
I am preparing the ROMS input grid file using the source data arising from "http://topex.ucsd.edu/WWW_html/srtm30_plus.html" web site and the Matlab utility named Seagrid.
Seagrid has produced the "s" matlab structured variable where "s.gridded_ bathymetry" contains NaN for all land cells and some negative values for some sea cells that are close to the shoreline. I wonder why it happen? Any suggestions? Have I to correct the values by hand or is there a facility to do that?
However I tried to use this "s.gridded_bathymety" (without any handmade correction) as input file for the utility "seagrid2roms": it produces the "roms_grd.nc" that contains the variable "h". The "h" variable has zero values corresponding to land cells and it has also zero values in the sea cells characterized by negative values in the s.gridded_bathymetry variable. Trying to run roms, it naturally stopped: I think that the problem is due to these zero values in cells (both sea and land cells) because if I define WET_DRY option the application runs without any problems.
Can anyone say me what have I to do to solve this problem?

Thank you very much,
Maria

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

### Re: SEAGRID use

Have you read the tutorial at
http://woodshole.er.usgs.gov/operations ... orial.html?
Seagrid has produced the "s" matlab structured variable where "s.gridded_ bathymetry" contains NaN for all land cells and some negative values for some sea cells that are close to the shoreline.
Once you call seagrid2roms routine from Matlab your .mat file will b converted to .nc. If you have set the minimum depth to 2m in Seagrid for example, the land bathymetry will be set to 2m instead of NAN.
The negative values that you have might be coming from the bathymetry data itself, but they ill also be set to 2m. Hope this helps.

mariafattorini
Posts: 52
Joined: Tue Mar 03, 2009 2:39 pm
Location: C.N.R. - LaMMA

### Re: SEAGRID use

Hi, Nacholibre,

I tried to do how you suggested me but perhaps I have not understood what I have to do.

I loaded coastline and bathymetry data in Seagrid and I set my grid; then I have set "MinimumDepth" (in "Seagrid Setup" window) to 2 and I saved Seagrid.mat file.
But if I load "seagrid.mat" file in Matlab by "load" command, I can see that the "s.gridded_bathymetry" variable contains NaN instead 2.

Where is my procediment wrong? I don't understand it.
Have you any idea?

Thank you much anyway,
Maria

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

### Re: SEAGRID use

You are on the right track. You need to convert that matlab grid file to a netCDF in order to feed into ROMS. Once you run "seagrid2roms" from the command line you will see that the NANs will convert to 2m. s.ClippingDepth in your matlab file contains the information about the minimum and maximum depth you want to have.

duckweed

### Re: SEAGRID use

Hi,

My problem is how to set vertical depth by seagrid? I had set the min depth and max depth by seagrid.I had computed the depth by seagrid.However,when i use seagrid2roms to generate grid.nc, the nc file have no depth , and no min depth,no max depth.
how to do?
Thanks a lot!

mariafattorini
Posts: 52
Joined: Tue Mar 03, 2009 2:39 pm
Location: C.N.R. - LaMMA

### Re: SEAGRID use

hello Duckweed,
if you load the grid.nc in Matlab, which variables apper in the workspace?