Using gradsnc to read the CCSM3 POP (ocean) data

Eric DeWeaver deweaver at AOS.WISC.EDU
Thu Feb 9 12:37:14 EST 2006


Hi Ching-Yee,

Here's the matlab script.  The data is read in by the 'netcdf'
function.  If you don't already have it you can get it at
mexcdf.sourceforge.net (installation is a little involved).

As for the pop_remap.ncl output, if you're still getting 'no
discernable x-coordinate' you might check the ncdump -h
output for the definition of longitude:

        double lon(lon) ;
                lon:long_name = "longitude" ;
                lon:units = "degrees_east" ;

Grads won't recognize longitude unless the units are "degrees_east"
(I think this is the COARDS standard).  You can fix this problem
with the ncatted, the netcdf attribute editor.  On the unix command
line type

  ncatted -a units,lon,o,c,"degrees_east" <filename>

ncatted is part of the nco package, online at nco.sourceforge.net.

Best Wishes,

Eric


On Thu, 9 Feb 2006, Ching-Yee wrote:

> Thank you all for your reply.
>
> I know that POP data are in different grid and needed to be interpolated,
> which I've done by using ncl pop_remap.ncl script (suggested by the CCSM3
> user guide). It seems that the output data from the pop_remap.ncl have the
> same grid that's readable by gradsnc (for example the output from CAM3),
> however, I still got the same response from gradsnc when using sdfopen.
> Maybe I still don't understand ncl and /or netCDF files enough.( It might
> not be appropriate to ask details about my ncl script.)
>
> James, do you use pop_remap.ncl to do the interpolation?
>
> Eric, I'd like to know how to use matlab to read the data. Can you please
> send me your matlab script?
>
> Thank you all very much.
>
> Ching-Yee
>
>
> -----Original Message-----
> From: Eric DeWeaver [mailto:deweaver at aos.wisc.edu]
> Sent: Thursday, February 09, 2006 11:15 AM
> To: Ching-Yee
> Cc: GRADSUSR at LIST.CINECA.IT
> Subject: Re: Using gradsnc to read the CCSM3 POP (ocean) data
>
>
> Hi Ching-Yee,
>
> I think the trouble is that the ocean model uses a grid in which the pole
> is displaced to Greenland.  I had the same problem with the CCSM3 sea ice
> data.  With the sea ice data, output from ncdump -h includes
>
>         float TLON(nlat, nlon) ;
>                 TLON:long_name = "T grid center longitude" ;
>                 TLON:units = "degrees_east" ;
>         float TLAT(nlat, nlon) ;
>                 TLAT:long_name = "T grid center latitude" ;
>                 TLAT:units = "degrees_north" ;
>         float ULON(nlat, nlon) ;
>                 ULON:long_name = "U grid center longitude" ;
>                 ULON:units = "degrees_east" ;
>         float ULAT(nlat, nlon) ;
>                 ULAT:long_name = "U grid center latitude" ;
>                 ULAT:units = "degrees_north" ;
>                 ULAT:comment = "Latitude of NE corner of T grid cell" ;
>
> So instead of having a "discernable x-coordinate" there are arrays which
> give the latitude and longitude of the (i,j)th grid cell.  To make things
> even more complicated, it's a B-grid, so there are different latitudes
> and longitudes for the temperature and the velocity.
>
> I couldn't find a way to plot this in grads.  I did it in matlab, and
> I'll be happy to send you the script.  One other suggestion: PCMDI has
> ocean and sea ice data for the IPCC AR4 model simulations which has been
> regridded to a standard lat/lon grid.  I know they have some data from
> CCSM3, maybe they have the stuff you want.  Their webpage is
>
>   http://www-pcmdi.llnl.gov/ipcc/about_ipcc.php
>
> Also, they might have a code that converts from the ocean model grid
> to a lat/lon grid.  Either that or somebody at NCAR has a code that
> does it (maybe an ncl code?).  You could contact the NCAR ocean
> model working group, they have a community liason who might know
> (see http://www.ccsm.ucar.edu/working_groups/Ocean/).
>
> Best Wishes,
>
> Eric
>
>
> On Thu, 9 Feb 2006, Ching-Yee wrote:
>
> > Dear grads users,
> > I would like to use gradsnc to read the CCSM3 ocean model (POP) output
> data
> > (in netCDF format), but when I use sdfopen the data, it said that "SDF
> file
> > has no discernable X coordinate."
> > I know there are CCSM3 POP output data that are placed at PCMDI/IPCC
> website
> > which are also in netCDF format, but accessible via gradsnc (sdfopen).
> >
> > Does anyone have any suggestions on how to use gradsnc to read the data?
> >
> > Thank you in advance.
> >
> > Ching-Yee
> >
>
-------------- next part --------------
% code to make a plot of sea ice thickness over the Arctic ocean.
clear
close
fin=netcdf('data.d/2003/b30.009/csim.ANN.nc');
hi=fin{'hi'}(1,:,:);
aice=fin{'aice'}(1,:,:);
tlon=fin{'TLON'}(:,:);
tlat=fin{'TLAT'}(:,:);
indx=find(tlat(:,1)>50); % only use high-latitude data
hi=hi(indx,:);
aice=aice(indx,:);
tlon=tlon(indx,:);
tlat=tlat(indx,:);

% these lines mask out values over land
index=find((hi==fin{'hi'}.missing_value));
hi(index)=NaN;
hi(find(hi==0))=NaN;

load coast
axm=axesm('MapProjection','stereo',...
          'FLatLimit',[-Inf 45],'Origin',[90 0 -54]);
% surfm(tlat,tlon,hi); % this makes a color-filled plot
[conm,chdl]=contourm(tlat,tlon,hi,[0:0.5:6.0],'linewidth',1.1);
patchesm(lat,long,0.8*[1 1 1]);    % this makes grey shading over land

set(gca,'layer','top');
clabel(conm,chdl,[1,2,3],'labelspacing',300,'fontsize',10);
[conm,chdl]=contourm(tlat,tlon,aice,[3 3],'linewidth',0.5,'linespec','--','color','k');

% this part shrinks the map so it's a rectangle centered over the
% Arctic ocean instead of a standard circular-shaped polar stereographic map.
lat1=64.25; lon1=-119.5; lat2=62.25; lon2=75.5; % the corners of the map
[x1,y1]=mfwdtran(lat1,lon1);
[x2,y2]=mfwdtran(lat2,lon2);
axis([x1 x2 y1 y2]);

print -depsc2 plot.eps



More information about the gradsusr mailing list