plotting bathymetry....

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
mashinde
Posts: 135
Joined: Mon Jun 22, 2009 3:46 pm
Location: Indian Institute of Tropical Meteorology, Pune, INDIA

plotting bathymetry....

#1 Unread post by mashinde »

I want to the plot bathymetry nc file which i created with seagrid. I am using
roms_wilkin's matlab plotting tools for the same. I created a simple script as below...


clear;
%
grd='roms_grd.nc';
file=grd;
cmap=zebra(2,64);
clev=[100 250 500 1000:1000:4000];
var = nc_varget(grd,'h');
%
han=roms_plot_bathy(file,cmap,clev,var);
%end


but it gives folowing errors.....


??? Undefined function or method 'get_roms_grid' for input arguments of type 'char'.

Error in ==> roms_plot_bathy at 12
grd = get_roms_grid(grd_file);

Error in ==> bathyplot at 24
han=roms_plot_bathy(file,cmap,clev,var);



I also attach here the ncdump output below......


ncdump('/home/mahesh/Desktop/roms_grd.nc') %% Generated 03-Sep-2009 16:52:46

nc = netcdf('/home/mahesh/Desktop/roms_grd.nc', 'noclobber');
if isempty(nc), return, end

%% Global attributes:

nc.type = ncchar(''Gridpak file'');
nc.gridid = ncchar('' '');
nc.history = ncchar(''Created by "seagrid2roms" on 17-Aug-2009 16:26:58'');
nc.CPP-options = ncchar(''DCOMPLEX, DBLEPREC, NCARG_32, PLOTS,'');

%% Dimensions:

nc('xi_psi') = 89;
nc('xi_rho') = 90;
nc('xi_u') = 89;
nc('xi_v') = 90;
nc('eta_psi') = 89;
nc('eta_rho') = 90;
nc('eta_u') = 90;
nc('eta_v') = 89;
nc('two') = 2;
nc('bath') = 0; %% (record dimension)

%% Variables and attributes:

nc{'xl'} = ncdouble; %% 1 element.
nc{'xl'}.long_name = ncchar(''domain length in the XI-direction'');
nc{'xl'}.units = ncchar(''meter'');

nc{'el'} = ncdouble; %% 1 element.
nc{'el'}.long_name = ncchar(''domain length in the ETA-direction'');
nc{'el'}.units = ncchar(''meter'');

nc{'JPRJ'} = ncchar('two'); %% 2 elements.
nc{'JPRJ'}.long_name = ncchar(''Map projection type'');
nc{'JPRJ'}.option(ME) = ncchar(''Mercator'');
nc{'JPRJ'}.option(ST) = ncchar(''Stereographic'');
nc{'JPRJ'}.option(LC) = ncchar(''Lambert conformal conic'');

nc{'PLAT'} = ncfloat('two'); %% 2 elements.
nc{'PLAT'}.long_name = ncchar(''Reference latitude(s) for map projection'');
nc{'PLAT'}.units = ncchar(''degree_north'');

nc{'PLONG'} = ncfloat; %% 1 element.
nc{'PLONG'}.long_name = ncchar(''Reference longitude for map projection'');
nc{'PLONG'}.units = ncchar(''degree_east'');

nc{'ROTA'} = ncfloat; %% 1 element.
nc{'ROTA'}.long_name = ncchar(''Rotation angle for map projection'');
nc{'ROTA'}.units = ncchar(''degree'');

nc{'JLTS'} = ncchar('two'); %% 2 elements.
nc{'JLTS'}.long_name = ncchar(''How limits of map are chosen'');
nc{'JLTS'}.option(CO) = ncchar(''P1, .. P4 define two opposite corners '');
nc{'JLTS'}.option(MA) = ncchar(''Maximum (whole world)'');
nc{'JLTS'}.option(AN) = ncchar(''Angles - P1..P4 define angles to edge of domain'');
nc{'JLTS'}.option(LI) = ncchar(''Limits - P1..P4 define limits in u,v space'');

nc{'P1'} = ncfloat; %% 1 element.
nc{'P1'}.long_name = ncchar(''Map limit parameter number 1'');

nc{'P2'} = ncfloat; %% 1 element.
nc{'P2'}.long_name = ncchar(''Map limit parameter number 2'');

nc{'P3'} = ncfloat; %% 1 element.
nc{'P3'}.long_name = ncchar(''Map limit parameter number 3'');

nc{'P4'} = ncfloat; %% 1 element.
nc{'P4'}.long_name = ncchar(''Map limit parameter number 4'');

nc{'XOFF'} = ncfloat; %% 1 element.
nc{'XOFF'}.long_name = ncchar(''Offset in x direction'');
nc{'XOFF'}.units = ncchar(''meter'');

nc{'YOFF'} = ncfloat; %% 1 element.
nc{'YOFF'}.long_name = ncchar(''Offset in y direction'');
nc{'YOFF'}.units = ncchar(''meter'');

nc{'depthmin'} = ncshort; %% 1 element.
nc{'depthmin'}.long_name = ncchar(''Shallow bathymetry clipping depth'');
nc{'depthmin'}.units = ncchar(''meter'');

nc{'depthmax'} = ncshort; %% 1 element.
nc{'depthmax'}.long_name = ncchar(''Deep bathymetry clipping depth'');
nc{'depthmax'}.units = ncchar(''meter'');

nc{'spherical'} = ncchar; %% 1 element.
nc{'spherical'}.long_name = ncchar(''Grid type logical switch'');
nc{'spherical'}.option(T) = ncchar(''spherical'');
nc{'spherical'}.option(F) = ncchar(''Cartesian'');

nc{'hraw'} = ncdouble('bath', 'eta_rho', 'xi_rho'); %% 0 elements.
nc{'hraw'}.long_name = ncchar(''Working bathymetry at RHO-points'');
nc{'hraw'}.units = ncchar(''meter'');
nc{'hraw'}.field = ncchar(''bath, scalar'');

nc{'h'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'h'}.long_name = ncchar(''Final bathymetry at RHO-points'');
nc{'h'}.units = ncchar(''meter'');
nc{'h'}.field = ncchar(''bath, scalar'');

nc{'f'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'f'}.long_name = ncchar(''Coriolis parameter at RHO-points'');
nc{'f'}.units = ncchar(''second-1'');
nc{'f'}.field = ncchar(''Coriolis, scalar'');

nc{'pm'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'pm'}.long_name = ncchar(''curvilinear coordinate metric in XI'');
nc{'pm'}.units = ncchar(''meter-1'');
nc{'pm'}.field = ncchar(''pm, scalar'');

nc{'pn'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'pn'}.long_name = ncchar(''curvilinear coordinate metric in ETA'');
nc{'pn'}.units = ncchar(''meter-1'');
nc{'pn'}.field = ncchar(''pn, scalar'');

nc{'dndx'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'dndx'}.long_name = ncchar(''xi derivative of inverse metric factor pn'');
nc{'dndx'}.units = ncchar(''meter'');
nc{'dndx'}.field = ncchar(''dndx, scalar'');

nc{'dmde'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'dmde'}.long_name = ncchar(''eta derivative of inverse metric factor pm'');
nc{'dmde'}.units = ncchar(''meter'');
nc{'dmde'}.field = ncchar(''dmde, scalar'');

nc{'x_rho'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'x_rho'}.long_name = ncchar(''x location of RHO-points'');
nc{'x_rho'}.units = ncchar(''meter'');

nc{'y_rho'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'y_rho'}.long_name = ncchar(''y location of RHO-points'');
nc{'y_rho'}.units = ncchar(''meter'');

nc{'x_psi'} = ncdouble('eta_psi', 'xi_psi'); %% 7921 elements.
nc{'x_psi'}.long_name = ncchar(''x location of PSI-points'');
nc{'x_psi'}.units = ncchar(''meter'');

nc{'y_psi'} = ncdouble('eta_psi', 'xi_psi'); %% 7921 elements.
nc{'y_psi'}.long_name = ncchar(''y location of PSI-points'');
nc{'y_psi'}.units = ncchar(''meter'');

nc{'x_u'} = ncdouble('eta_u', 'xi_u'); %% 8010 elements.
nc{'x_u'}.long_name = ncchar(''x location of U-points'');
nc{'x_u'}.units = ncchar(''meter'');

nc{'y_u'} = ncdouble('eta_u', 'xi_u'); %% 8010 elements.
nc{'y_u'}.long_name = ncchar(''y location of U-points'');
nc{'y_u'}.units = ncchar(''meter'');

nc{'x_v'} = ncdouble('eta_v', 'xi_v'); %% 8010 elements.
nc{'x_v'}.long_name = ncchar(''x location of V-points'');
nc{'x_v'}.units = ncchar(''meter'');

nc{'y_v'} = ncdouble('eta_v', 'xi_v'); %% 8010 elements.
nc{'y_v'}.long_name = ncchar(''y location of V-points'');
nc{'y_v'}.units = ncchar(''meter'');

nc{'lat_rho'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'lat_rho'}.long_name = ncchar(''latitude of RHO-points'');
nc{'lat_rho'}.units = ncchar(''degree_north'');

nc{'lon_rho'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'lon_rho'}.long_name = ncchar(''longitude of RHO-points'');
nc{'lon_rho'}.units = ncchar(''degree_east'');

nc{'lat_psi'} = ncdouble('eta_psi', 'xi_psi'); %% 7921 elements.
nc{'lat_psi'}.long_name = ncchar(''latitude of PSI-points'');
nc{'lat_psi'}.units = ncchar(''degree_north'');

nc{'lon_psi'} = ncdouble('eta_psi', 'xi_psi'); %% 7921 elements.
nc{'lon_psi'}.long_name = ncchar(''longitude of PSI-points'');
nc{'lon_psi'}.units = ncchar(''degree_east'');

nc{'lat_u'} = ncdouble('eta_u', 'xi_u'); %% 8010 elements.
nc{'lat_u'}.long_name = ncchar(''latitude of U-points'');
nc{'lat_u'}.units = ncchar(''degree_north'');

nc{'lon_u'} = ncdouble('eta_u', 'xi_u'); %% 8010 elements.
nc{'lon_u'}.long_name = ncchar(''longitude of U-points'');
nc{'lon_u'}.units = ncchar(''degree_east'');

nc{'lat_v'} = ncdouble('eta_v', 'xi_v'); %% 8010 elements.
nc{'lat_v'}.long_name = ncchar(''latitude of V-points'');
nc{'lat_v'}.units = ncchar(''degree_north'');

nc{'lon_v'} = ncdouble('eta_v', 'xi_v'); %% 8010 elements.
nc{'lon_v'}.long_name = ncchar(''longitude of V-points'');
nc{'lon_v'}.units = ncchar(''degree_east'');

nc{'mask_rho'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'mask_rho'}.long_name = ncchar(''mask on RHO-points'');
nc{'mask_rho'}.option(0) = ncchar(''land'');
nc{'mask_rho'}.option(1) = ncchar(''water'');

nc{'mask_u'} = ncdouble('eta_u', 'xi_u'); %% 8010 elements.
nc{'mask_u'}.long_name = ncchar(''mask on U-points'');
nc{'mask_u'}.option(0) = ncchar(''land'');
nc{'mask_u'}.option(1) = ncchar(''water'');

nc{'mask_v'} = ncdouble('eta_v', 'xi_v'); %% 8010 elements.
nc{'mask_v'}.long_name = ncchar(''mask on V-points'');
nc{'mask_v'}.option(0) = ncchar(''land'');
nc{'mask_v'}.option(1) = ncchar(''water'');

nc{'mask_psi'} = ncdouble('eta_psi', 'xi_psi'); %% 7921 elements.
nc{'mask_psi'}.long_name = ncchar(''mask on PSI-points'');
nc{'mask_psi'}.option(0) = ncchar(''land'');
nc{'mask_psi'}.option(1) = ncchar(''water'');

nc{'angle'} = ncdouble('eta_rho', 'xi_rho'); %% 8100 elements.
nc{'angle'}.long_name = ncchar(''angle between xi axis and east'');
nc{'angle'}.units = ncchar(''degree'');

endef(nc)
close(nc)


Can anybody suggest the solution....


Thanking you

Mahesh

eivinds
Posts: 8
Joined: Mon Sep 28, 2009 6:08 pm
Location: Geosciences, Univ. of Oslo

Re: plotting bathymetry....

#2 Unread post by eivinds »

Hello mashinde.
To my understanding it seems this error is due to a typo in the file roms_plot_bathy.m. Line 12 in that file should not be grd = get_roms_grid(grd_file);, but rather grd = roms_get_grid(grd_file);. That error is present in my roms_wilkin files as well

Eivind

User avatar
wilkin
Posts: 875
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: plotting bathymetry....

#3 Unread post by wilkin »

It is fixed now. svn update your code or make the changes yourself. The required correction is pretty obvious.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

Post Reply