Seagrid Error
-
- Posts: 19
- Joined: Fri Jul 30, 2010 3:56 am
- Location: Pontifica Universidad Catolica de Chile
Seagrid Error
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
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
-
- Posts: 19
- Joined: Fri Jul 30, 2010 3:56 am
- Location: Pontifica Universidad Catolica de Chile
Re: Seagrid Error
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
>> 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
-
- Posts: 2
- Joined: Wed Apr 29, 2009 12:08 am
- Location: Universidade Estadual Paulista, São Paulo, Brasil.
Re: Seagrid Error
hi,
i just wonder if someone has solved this issue (seagrid2roms @line 164).
cheers,
Roberto.
i just wonder if someone has solved this issue (seagrid2roms @line 164).
cheers,
Roberto.
Re: Seagrid Error
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
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
Re: Seagrid Error
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!
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!
-
- Posts: 2
- Joined: Wed Apr 29, 2009 12:08 am
- Location: Universidade Estadual Paulista, São Paulo, Brasil.
Re: Seagrid Error
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.
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.
-
- Posts: 19
- Joined: Fri Jul 30, 2010 3:56 am
- Location: Pontifica Universidad Catolica de Chile
Re: Seagrid Error
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
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
-
- Posts: 19
- Joined: Fri Jul 30, 2010 3:56 am
- Location: Pontifica Universidad Catolica de Chile
Re: Seagrid Error
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?.
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?.
-
- Posts: 81
- Joined: Thu Dec 07, 2006 3:14 pm
- Location: USGS
- Contact:
Re: Seagrid Error
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
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
Re: Seagrid Error
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.
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.
Re: Seagrid Error
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 )
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.
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 )
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.
-
- Posts: 81
- Joined: Thu Dec 07, 2006 3:14 pm
- Location: USGS
- Contact:
Re: Seagrid Error
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
Zafer
Re: Seagrid Error
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
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
Re: Seagrid Error
Hi again.
Finally i click over all the points to apply the mask correctly, please take a look. 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
Finally i click over all the points to apply the mask correctly, please take a look. 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
-
- Posts: 81
- Joined: Thu Dec 07, 2006 3:14 pm
- Location: USGS
- Contact:
Re: Seagrid Error
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
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
Re: Seagrid Error
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.
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.
Re: Seagrid Error
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.
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.
-
- Posts: 81
- Joined: Thu Dec 07, 2006 3:14 pm
- Location: USGS
- Contact:
Re: Seagrid Error
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.
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.
Re: Seagrid Error
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
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
Re: Seagrid Error
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.
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.
- jivica
- Posts: 172
- Joined: Mon May 05, 2003 2:41 pm
- Location: The University of Western Australia, Perth, Australia
- Contact:
Re: Seagrid Error
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
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
Re: Seagrid Error
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
could i get your email? i can send you or upload to UD dropbox, but in any case i need your mail.
thanks
-
- Posts: 19
- Joined: Fri Jul 30, 2010 3:56 am
- Location: Pontifica Universidad Catolica de Chile
Re: Seagrid Error
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
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
- jivica
- Posts: 172
- Joined: Mon May 05, 2003 2:41 pm
- Location: The University of Western Australia, Perth, Australia
- Contact:
Re: Seagrid Error
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
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:
Code: Select all
% 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);
Code: Select all
Ivica
Re: Seagrid Error
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
Re: Seagrid Error
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!
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!