Is it mandatory to get bathymetry from the net??

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
perezro

Is it mandatory to get bathymetry from the net??

#1 Post by perezro » Tue Jul 28, 2009 8:08 am

Other question, when I try to use "read_srtm30plus.m" to get bathymetry matlab connect with the web data available, right? but if I do have an particular bathymetry file (baltic_1x1.nc) with the data I would like to use I should modify the read_srtm30plus.m script.
The problem is that I don't know how. Could you, please, sketch how the new scrip should looks like?
Thanks a lot! r

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

Re: Is it mandatory to get bathymetry from the net??

#2 Post by rsignell » Tue Jul 28, 2009 6:20 pm

You don't really need to modify the SRTM script. Just read your topography NetCDF file using any Matlab/NetCDF tool (snctools, for example), and save off some subsampled set of points as xbathy, ybathy and zbathy in a mat file. Then you can use these points as the "bathymetry data" for seagrid just so you can have an idea of what the bathymetry looks like while you are making your grid, then go back later after the ROMS grid file has been produced, go back in and replace the bathymetry using whatever interpolation scheme you want from your full bathy data.

perezro

Re: Is it mandatory to get bathymetry from the net??

#3 Post by perezro » Wed Jul 29, 2009 7:59 am

Thank you, thank you, thank you, I already upgrade to 2008b and install mex and netcdf..
I will try to figure out what do you mean exactly... I mean how could I get a sample of the points and how I set them as Xbathy ybathy and zbathy (and save as .mat),
I mean I am really new on this and even I did not look so deeply for info of netcdf or .nc files in general , I do not know how to do so.. (Is there a manual, tutorial???)
Best regards, r

perezro

Re: Is it mandatory to get bathymetry from the net??

#4 Post by perezro » Thu Jul 30, 2009 9:21 am

Hello everyone!

I figure out (with some help..) how to get Xbathy ybathy and zbathy... and then plot them out...
clear
close all
clear nc
clear myfile
myfile='gulf_finland_1x1.nc'
disp(myfile)
ncid = netcdf.open(myfile,'NC_NOWRITE');
[dimname, dimlen] = netcdf.inqDim(ncid,1)

[ndims,nvars,natts,unlimdimID]= netcdf.inq(ncid)
%
% %[varname,xtype,dimids,numatts]= netcdf.inqVar(ncid,j)
for i = 1:nvars
j=i-1
[varname]= netcdf.inqVar(ncid,j)
end

%........................................................................

[varname, xtype, varDimIDs, varAtts] = netcdf.inqVar(ncid,0);
varid = netcdf.inqVarID(ncid,varname);
lat = netcdf.getVar(ncid,varid);
[varname, xtype, varDimIDs, varAtts] = netcdf.inqVar(ncid,1);
varid = netcdf.inqVarID(ncid,varname);
lon = netcdf.getVar(ncid,varid);
[varname, xtype, varDimIDs, varAtts] = netcdf.inqVar(ncid,2);
varid = netcdf.inqVarID(ncid,varname);
z = netcdf.getVar(ncid,varid);

[nx,ny]=size(z)
%
% .........................................................................
for j=1:nx
for i=1:ny
zbathy(i,j)=z(j,i);
xbathy(i,j)=lon(j);
ybathy(i,j)=lat(i);
end
end
contour(xbathy,ybathy,zbathy)
% clear


but if i try to save them using >>save ('bathy4seagrid.mat', 'xbathy', 'ybathy' 'zbathy') makes a file that seagrid recognice but with and error

>> seagrid
??? Error using ==> horzcat
CAT arguments dimensions are not consistent.

Error in ==> seagrid.getbathymetry at 87
set([gca h], 'ButtonDownFcn', theButtonDownFcn)

Error in ==> seagrid.doevent at 218
getbathymetry(self)

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

??? Error while evaluating uimenu Callback


theOrthogonalityFlag =

[]


theBathymetryFlag =

[]


theMaskingFlag =

[]


theMaskTool =

[]


theMaskToolFlag =

0


theOrthogonalityFlag =

[]


theBathymetryFlag =

1


theMaskingFlag =

[]


theMaskTool =

[]


theMaskToolFlag =

1

??? Error using ==> griddata at 61
Input data cannot be complex.

Error in ==> seagrid.dobathymetry at 79
zi = griddata(x, y, z, xi, yi, theGriddingMethod); % Grid z.

Error in ==> seagrid.doupdate at 110
self = dobathymetry(self, needsBathymetry); % <== Step #5 <==

Error in ==> seagrid.doevent at 93
doupdate(self, needsUpdate)

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

??? Error while evaluating uimenu Callback


myfile =

gulf_finland_1x1.nc

gulf_finland_1x1.nc

dimname =

lon


dimlen =

481


ndims =

2


nvars =

3


natts =

4


unlimdimID =

-1


j =

0


varname =

lat


j =

1


varname =

lon


j =

2


varname =

z


nx =

481


ny =

181

>> seagrid
??? Error using ==> horzcat
CAT arguments dimensions are not consistent.

Error in ==> seagrid.getbathymetry at 87
set([gca h], 'ButtonDownFcn', theButtonDownFcn)

Error in ==> seagrid.doevent at 218
getbathymetry(self)

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

??? Error while evaluating uimenu Callback



I don't know!?!? what could I do???
Thanks: R

perezro

Re: Is it mandatory to get bathymetry from the net??

#5 Post by perezro » Mon Aug 03, 2009 6:41 am

I figured out.. :)
Thanks anyhow: R

Post Reply