Seagrid Error

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
nils.lindeen
Posts: 19
Joined: Fri Jul 30, 2010 3:56 am
Location: Pontifica Universidad Catolica de Chile

Seagrid Error

#1 Post by nils.lindeen » Fri Oct 22, 2010 6:27 pm

Hi,

I have been trying to create my grid file with the seagrid package, yet I get the following error when running it con Matlab.

>> seagrid2roms('seagrid.mat','romsgrid.nc','optional comment to put in the netcdf file')
## SeaGrid Source File : seagrid.mat
## ROMS Destination File: romsgrid.nc
??? Undefined function or method 'netcdf' for input arguments of type 'char'.

Error in ==> seagrid2roms at 152
nc = netcdf(theRomsFile, 'clobber');

I checked the "seagrid2roms" file and it uses a "netcdf" function, which is not included anywhere in the seagrid package. Is this a seagrid error or is it a function Matlab should have included. I am using Matlab R2007a, yet have already added all the toolboxes that where required. I hope someone can help me solve this issue.Thanks alot.

Regards,

Nils

nils.lindeen
Posts: 19
Joined: Fri Jul 30, 2010 3:56 am
Location: Pontifica Universidad Catolica de Chile

Re: Seagrid Error

#2 Post by nils.lindeen » Fri Oct 22, 2010 7:06 pm

Sorry, problem solved, I downloaded the NetCDF Toolbox and solved it. yet now I get the following error:

>> seagrid2roms('seagrid.mat','romsgrid.nc','optional comment to put in the netcdf file')
## SeaGrid Source File : seagrid.mat
## ROMS Destination File: romsgrid.nc
## Defining Global Attributes...
??? Undefined function or method 'name' for input arguments of type 'double'.

Error in ==> seagrid2roms at 164
name(nc.CPP_options, 'CPP-options')

This is strange because if I write >>which name, it finds the function. I hope someone knows the reason to this problem.

Regards

rcfontes
Posts: 2
Joined: Wed Apr 29, 2009 12:08 am
Location: Universidade Estadual Paulista, São Paulo, Brasil.

Re: Seagrid Error

#3 Post by rcfontes » Fri Dec 31, 2010 4:37 pm

hi,

i just wonder if someone has solved this issue (seagrid2roms @line 164).

cheers,

Roberto.

leonjld
Posts: 51
Joined: Fri Feb 27, 2004 6:30 pm
Location: NOAA/NESDIS/STAR

Re: Seagrid Error

#4 Post by leonjld » Sat Jan 01, 2011 4:41 am

Hi Roberto,

the errors came from the matlab mexnc interface (the toolbox you downloaded). Matlab 7.7+ all have native netcdf support so that you don't need netcdf toolbox. But what you need to do is to re-write the netcdf I/O in the m file using matlab native netcdf functions, which is what I have done. If you what to save some time, just pm me your email and I can share it with you.

Lide

dhd_1979
Posts: 5
Joined: Sun Dec 26, 2010 9:38 pm
Location: Marine Blue Australia

Re: Seagrid Error

#5 Post by dhd_1979 » Mon Jan 03, 2011 4:25 am

Hi leonjld,

In my test, I get the error:

>> seagrid2roms('seagrid.mat', 'test.grd');
## SeaGrid Source File : seagrid.mat
## ROMS Destination File: test.grd
## Defining Global Attributes...
??? Undefined function or method 'endef' for input arguments of type 'double'.

Error in ==> ncvar.subsref at 265
theNetCDF = endef(theNetCDF);

Error in ==> ncitem.feval at 23
varargin{i} = varargin{i}(:); % Whole data.

Error in ==> ncmex at 139
[varargout{:}] = feval(fcn, varargin{:});

Error in ==> ncatt.ncatt at 125
status = ncmex('attput', theNCid, theVarid, ...

Error in ==> netcdf.subsasgn at 121
result = ncatt(theAttname, ncclass(other), other, self);

Error in ==> seagrid2roms at 149
nc.type = ncchar('Gridpak file');


??? Input argument "Gname" is undefined.

Error in ==> c_grid at 31
if (exist(Gname)),


It sames that the toolbox does not work correctly and the problem have troubled me for a long time. So can you share me your works using matlab native netcdf functions? My email is liu_qu66@live.cn

Thanks!

rcfontes
Posts: 2
Joined: Wed Apr 29, 2009 12:08 am
Location: Universidade Estadual Paulista, São Paulo, Brasil.

Re: Seagrid Error

#6 Post by rcfontes » Tue Jan 04, 2011 2:24 am

Hi Lide,

thanks for your kindly offer - it will really save some precious time. I'm not allowed to send private messages in this forum. Would you please send the m-scripts to either "fioravanti.carelli@gmail.com" or "rcfontes@clp.unesp.br" (?)

Thanks again,

ROberto.

nils.lindeen
Posts: 19
Joined: Fri Jul 30, 2010 3:56 am
Location: Pontifica Universidad Catolica de Chile

Re: Seagrid Error

#7 Post by nils.lindeen » Wed Jan 05, 2011 9:16 pm

Lide:

I would be really thankful if you could help me out by sending me those files as well. I am still stuck with same problem since November and haven't been able to solve it. I hope there it's ok by you. Thanks alot.

Best regards,

Nils

nils.lindeen
Posts: 19
Joined: Fri Jul 30, 2010 3:56 am
Location: Pontifica Universidad Catolica de Chile

Re: Seagrid Error

#8 Post by nils.lindeen » Wed Jan 05, 2011 9:17 pm

Sorry I forgot to post my email address:

nelindee@uc.cl
nils.lindeen@gmail.com

Thank you!

dnavidad

Re: Seagrid Error

#9 Post by dnavidad » Mon Apr 11, 2011 5:40 pm

Hello,

I am making the ROMS grid with seagrid, maybe i could ask you for some help.

I am working with the land mask and selecting sea points manually with the mouse. The problem is that if you have a very fine grid that can takes a lot of time and sometimes the zoom tool of seagrid doesn't work properly.

do you know a better way to do that?.

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

Re: Seagrid Error

#10 Post by nacholibre » Tue Apr 12, 2011 3:33 pm

Try zoom in and out by pressing
ctrl + [ and ctrl + ]
and zoom to extent
ctrl + \
Also you can try turning off the mask when you zoom out, so that the grid will draw much faster. You can also try changing your graphics renderer from painters to openGL (if you have openGL), but I haven't experienced much difference in doing so.
In order to zoom into an area of interest you might need to zoom in a few times and pan the map by right clicking. Zooming in and panning consecutively will work for your purpose, but you need to click outside the map box when using them.
Zafer

dnavidad

Re: Seagrid Error

#11 Post by dnavidad » Tue Apr 12, 2011 6:20 pm

ok, i think that what i am doing. just zoom in and out to get the point easily.


but i think that the problem is other, let me explain i have a grid with about 5*10e4 and seagrid doesn't make the mask good by default. the most sea grid points are taken like land so i have to click over the most of them, i am talking about thousands points. When i touch accidentally in one of the grid limit line, when i am selecting the sea point for the mask, suddenly the mask vanishes and all the work done is lost. (It is the second time it happens)

Is there the options to save the mask before finish to do it.? if i save the seagrid file while i am doing the mask the mask is saved also.

thanks.

dnavidad

Re: Seagrid Error

#12 Post by dnavidad » Tue Apr 12, 2011 7:28 pm

i've see that although you save the file seagrid once you modify the mask (clicking in the sea points) you never recover this mask again. when you load the seagrid file again and go compute/land mask you start from the beginning.


My grid is rotated like 45º counterclockwise two of the boundary (deep and shallow ones) are parallel to the coastline (NE trimed) and the two remaining are practically opened boundary. Seagrid, trying to follow the geometry of the cosatline beyond my area and extending the coast line, selects most of my sea points as land ones. (please let me attach the file
grid.jpg
)


I see that seagrid has the option to load the boundary file. i have never try that. i wonder if maybe using this kind of file i could specify seagrid better my area and get that the mask works.

thanks.

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

Re: Seagrid Error

#13 Post by nacholibre » Tue Apr 12, 2011 8:32 pm

Seagrid decides on the land cells by automatically connecting the two ends of your coastline array. You can modify the coordinates of these two ends and move them towards the land so that you will get Seagrid to generate a correct polygon for the land.
Zafer

dnavidad

Re: Seagrid Error

#14 Post by dnavidad » Wed Apr 13, 2011 7:06 pm

Sorry

i didn't understand so well. You meant that i have to modify the shape of the grid? moving my deep-water points towards shallow water? that's mean to reduce the length or wide of my grid.

thanks

dnavidad

Re: Seagrid Error

#15 Post by dnavidad » Wed Apr 13, 2011 10:39 pm

Hi again.

Finally i click over all the points to apply the mask correctly, please take a look.
grid2.jpg
but when i try to save the .mat file, assuming that my mask will be save, i get this error.


??? Undefined variable "u" or class "u.strips".

Error in ==> grid2mask at 183
x = get(u.strips(1), 'XData');

Error in ==> seagrid.domasktool at 126
theMask = grid2mask('done');

Error in ==> seagrid.dosave at 63
domasktool(self) % Turn it off.

Error in ==> seagrid.doevent at 283
dosave(self)

Error in ==> psevent at 25
doevent(ps(gcbf), theEvent, theMessage);

??? Error using ==> psevent Callback
Undefined variable "u" or class "u.strips".

??? Error while evaluating uimenu Callback

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

Re: Seagrid Error

#16 Post by nacholibre » Wed May 11, 2011 8:58 pm

David,
Sorry to get back to you so late. But I haven't seen your post earlier. I remember getting that error when I was working on the grids, but I cannot recall what the issue was. It has been a long time since then. I had to modify the seagrid codes myself for my needs and maybe I did not have that issue after that. Do you still experience the same problem?
Zafer

dnavidad

Re: Seagrid Error

#17 Post by dnavidad » Thu May 12, 2011 4:07 am

Hi Zafer, thanks.

I think that the problem still persit. now i was trying to work with a coarse grid to avoid make zoom out and in. but i will need to make a finer grid. so i will need help to solve this problem.

by the way, about seagrid:

1)i want to use a source point for a river runoff, i have to specify some parameter in roms, like the point grid indexs where the source point is. i guess that the seagrid.mat save information. HOw indetify the index of the point selected be the source? i tried to overplot my point in the seagrid interface together with the grid, but i couldn't.

2 why it is necesary to use land mask in seagrid if you have a bathymetry file with negative and positive values.

thanks in advance.

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

Re: Seagrid Error

#18 Post by kate » Thu May 12, 2011 4:22 pm

1. Try editmask - you can see the i,j values for the point under the mouse.

2. Years before the WET_DRY option, we had the MASKING option. If you want all your points to potentially be wet, don't use MASKING.

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

Re: Seagrid Error

#19 Post by nacholibre » Thu May 12, 2011 4:34 pm

For any of your questions I suggest that you take a look at the ROMS documentation at WikiRoms first. https://www.myroms.org/wiki/index.php/D ... ion_Portal.

Masked cells are excluded in the calculations therefore masking reduces the computational load. Also it gives user the flexibility of determining whether a cell is wet or permanently dry.

The river runoff can be defined analytically or through netCDF forcing file. It is not defined with SeaGrid. As to the finding the location of your point on Matlab plot, you need to be careful about the way the matrices handled in ROMS and in Matlab. Any coordinate that you define in Matlab will need to be transformed to ROMS coordinates. It will be a transform in the form of Matlab(x,y) -> ROMS(X, Y), where X=y+offset_y and Y=x+offset_x the offset values depending on whether you are using the rho points, u points or v points.

dnavidad

Re: Seagrid Error

#20 Post by dnavidad » Thu May 12, 2011 10:30 pm

kate, many thanks.

i was not sure about what the seagrid masking is doing, i wonder if it was really necessary to build the netcd file or it is like the SWAN exception points to not perform any calculation in them. potentially all my land points will be wet_dry points.

i'll try edit mask.

very helpfull your comments,

thanks

dnavidad

Re: Seagrid Error

#21 Post by dnavidad » Thu May 12, 2011 10:55 pm

ok, Zafer.

Veeery usefull. i used to use the wikiroms, for take a look to the cpp's and others, but really in the forum one can find, the exact answer sometimes.

thanks.

User avatar
jivica
Posts: 135
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

Re: Seagrid Error

#22 Post by jivica » Fri May 13, 2011 12:48 am

It is simply not true that MASKED points are not used in computations!
They are just zeroed out at the end of time step (!) we have been through that zillion times.
ROMS is different animal than say SWAN which excludes those points from calculations.
Navidad if you are still struggling with your grid put it somewhere on net so I can grab it and checked to save time.

Cheers,
Ivica

dnavidad

Re: Seagrid Error

#23 Post by dnavidad » Fri May 13, 2011 5:06 pm

yes, please.

could i get your email? i can send you or upload to UD dropbox, but in any case i need your mail.

thanks

nils.lindeen
Posts: 19
Joined: Fri Jul 30, 2010 3:56 am
Location: Pontifica Universidad Catolica de Chile

Re: Seagrid Error

#24 Post by nils.lindeen » Fri May 13, 2011 9:28 pm

navidad,

i had all the same problems you had, but have learnt how to overcome them.

when seagrid doesnt let you save, just update the grid, then to depths again, and after that it will let you save.

about land masking manually, i beleive there is no solution. i have been forced to do this manually as well and have lost a lot of time. but you actually can save it half way. just save it, and next time dont do mask, do depths and then continue to land mask manually.

any other problems just let me know.

greets,

nils

User avatar
jivica
Posts: 135
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

Re: Seagrid Error

#25 Post by jivica » Fri May 13, 2011 9:39 pm

You can do landmasking by a) using landmask utility in roms matlab toolbox
or b) if you have coastal line in polyline (closed lines stored in matlab struct ie poly(1).lon poly(1).lat and so on for other islands like poly(n).lon poly(n).lat ...) you can do it easy in matlab by checking roms grid points if inside polygon (inpoly function) .. something like this: function [rmask,umask,vmask,pmask]=make_mask(grid,poly)
% makes mask_rho for grid based on polyline (lon lat)
rmask=ones(size(grid.lonr));

for i=1:length(poly);
ind=inpoly([grid.lonr(:) grid.latr(:)],[poly(i).x,poly(i).y]);
ok=find(ind==1);
rmask(ok)=0;
end;

[umask,vmask,pmask]=uvp_mask(rmask); Cheers,
Ivica

jkansong
Posts: 5
Joined: Thu May 15, 2014 4:08 pm
Location: University of Michigan

Re: Seagrid Error

#26 Post by jkansong » Thu Jun 05, 2014 3:04 pm

leonjld wrote:Hi Roberto,

the errors came from the matlab mexnc interface (the toolbox you downloaded). Matlab 7.7+ all have native netcdf support so that you don't need netcdf toolbox. But what you need to do is to re-write the netcdf I/O in the m file using matlab native netcdf functions, which is what I have done. If you what to save some time, just pm me your email and I can share it with you.

Lide

jkansong
Posts: 5
Joined: Thu May 15, 2014 4:08 pm
Location: University of Michigan

Re: Seagrid Error

#27 Post by jkansong » Thu Jun 05, 2014 4:16 pm

Hi Lide,

Could you please send me your modified netcdf I/O for seagrid. I'm having problems with seagrid2roms.m like Rouf's described. My email is jkansong@umich.edu

Thanks!

Post Reply