writing fortran programs to read netcdf files

Jason Snyder jmssnyder at UCDAVIS.EDU
Thu Apr 2 02:08:34 EDT 2009


I am not exactly sure where to put my input program in.  I have a program of
global zonal wind data, with dimensions time, latitude, longitude, pressure
levels.  I was under the impression and this is how I have done programs
reading NetCDF in the past, that you use ncopn to open NetCDF files.  I have
the netcdf.inc file and ngen.h in the current directory where my program
is.  Here is a copy of the program as it stands right now.  Can anyone help
me with isolating out the problems with this program because it has been a
while since I have used programs of reading and writing NetCDF files and I
am a little rusty on it now.


c latitude, longitude, time

parameter(nlat=37,nlon=144,nyr=3288)

c number of dimensions

parameter(nvar=10)

parameter(ndims=3)

integer nci(nvar),ncid,iselvar(nvar)

integer input(nvar)

integer i,j,k

include 'netcdf.inc'

c data variables

real data(nlon,nlat), count(nlon,nlat,nyr)

real wnd(nlon,nlat,nyr)

c grads output files

parameter (undef=-9999.)

c open all netcdf files

nci(1)=ncopn('uwnd.2002.nc',ncnowrit,rcode)

data start/1,1,1/

count(1)=nlon

count(2)=nlat

count(3)=1

count(3)=nyr

call ncagt(ncid,id,start,count,i2dat,rcode)

call ncvgt(ncid,id,start,count,i2dat,rcode)

stop

end
Thanks,

Jason

On Wed, Apr 1, 2009 at 10:34 PM, Chi Mai Nguyen <
Chi.Nguyen at sci.monash.edu.au> wrote:

> Hi Jason,
>
> I have a small program doing various things, including reading and writing
> from and to netcdf file. You'll need to check the code inside.
>
> Subroutine getvars => open and get variables from netcdf file
> subroutine w2Dh => create and output variables to a new netcdif file
>
> You will need to use netcdf libraries to complile.
>
> Cheers and good luck!
> Mai
>
> Jason Snyder <jmssnyder at UCDAVIS.EDU> wrote:
> > I have a series of netcdf files that I want to filter out data in terms
> > of
> > specific Madden Julian Oscillation indices.  I am trying to design a
> > fortran program to read netcdf so that I could do calculations with the
> > data and write the results back into a netcdf file.  In this I want to
> > filter out all dates for a specific Madden Julian Oscillation index and
> > then average the data to get an average zonal wind profile for that
> > specific index of MJO and how the winds change on average several days
> > before that date. I was wondering how to design a fortran program to read
> > netcdf files and write netcdf files?  Can someone send me an example of
> > such a program.
> >
> > Thanks,
> >
> > jason
> --
> *********************************
> Nguyen Chi Mai
> School of Mathematical Sciences
> Rm 225, Bld. 28, Clayton Campus
> Monash University
> Work Ph. +61 3 9905 4458
> www.maths.monash.edu.au/~cmnguyen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20090401/1b0c82ed/attachment.html 


More information about the gradsusr mailing list