[Thread Prev][Thread Next][Index]
Re: Transform World Ocean Atlas 1/4 x 1/4 degree to NEtCDF
Hi Namba, James, Joe & others,
What about doing the ascii to NetCDf
conversion in Ferret itself ? I just made a script to do this (please
see the attchment ascii2nc.jnl) for the monthly climatology dataset.
You can find the details inside the script. To use this script :
1. Get the temperature/salinity ascii data files (t001_v2.gz..
or s001_v2.gz) from
http://www.nodc.noaa.gov/OC5/WOA01/qd_ts01.html for all
12 months & unzip it.
If you are dealing with seasonal/annual climatology, you
have to modify the script according to that.
2. In ascii2nc.jnl, under USER INPUT choose
a) prfx ==> "t" for temp and "s" for salinity
b) varname ==> name of output variable
c) outfile ==> output filename
d) vartitle ==> a meaningfull title for the variable
e) varunits ==> units for the variable
3. Start Ferret with more memory cache..like
[user@machine]$ ferret -memsize 300mb
and run ascii2nc.jnl
IF your Ferret version is not 5.6 or 5.7 you have to modify
the REPEAT loop towards the end of the script.
Please note that currently the script takes care off data upto 1500m
only. If you want to have the seasonal/annual fields below this depth
upto 5500m, you have to modify the script.
Let me know if you have any questions.
Hope this helps
With Regards
Jaison
On Wed, 1 Dec 2004, James Harle wrote:
> Dear Takaya
>
> I have been recently using the WOA 1/4 degree data and have converted
> them into netdcf. The way I did it was modify the fortran code
> generated from the UNIX ncgen routine for a typical netcdf file. I will
> forward the routine to you, but if anyone else would like a copy just
> drop me an email. It combines T and S data into one netcdf file and
> fills in the deeper levels in the monthly mean files with either
> seasonal or annual means (i think - I haven't used the routine for
> ages).... if you have any questions just ask!
>
> Cheers
>
> James
>
> On 1 Dec 2004, at 01:51, namba takaya wrote:
>
> > Dear Joe
> >
> > Thank you very much for your kindness.
> > If I can get the fortran code for 1 x 1 degree to NetCDF with the
> > acceptance of Mark, I am very pleased and will be able to modify it
> > for 1/4 x 1/4 by myself.
> > Best Regards,
> >
> > Takaya Namba
> >> From: Joe McLean <joe.mclean@noaa.gov>
> >> To: namba takaya <takayanamba11@hotmail.com>
> >> CC: ferret_users@noaa.gov, "Mark.Collier@csiro.au"
> > <Mark.Collier@csiro.au>
> >> Subject: Re: Transform World Ocean Atlas 1/4 x 1/4 degree to NEtCDF
> >> Date: Tue, 30 Nov 2004 14:43:51 -0800
> >>
> >> Namba-san,
> >>
> >> I see what you are talking about now. In February, 2003, I put out the
> >> word through both the Ferret users and LAS users mailing lists that I
> >> was looking for a way to translate the NODC/OCL World Ocean Atlas data
> >> from the native OCL format to NetCDF format. The OCL format is a
> >> unique
> >> compressed ascii representation of the data, and is not conducive to
> >> Ferret commands for reading ASCII data.
> >>
> >> I received an answer from, among others, Mark Collier at CSIRO. Mark
> >> actually supplied me with the NetCDF files which he created. They hold
> >> the 1 x 1 degree resolution of the data. I only glanced at the Fortran
> >> code which he developed to do this, but you may be able to edit and
> >> use
> >> this same code on the .25 degree OCL formatted files to create NetCDF
> >> files. I have cc'd Mark with this email. If Mark wishes, I can supply
> >> the code to you. Let me know if there is more I can do to help.
> >>
> >> Joe
> >> ---------------------
> >> namba takaya wrote:
> >>
> >> > Dear Joe
> >> >
> >> > Thank you very much for your kind reply.
> >> >
> >> > I downloaded the high resolution files of 1/4 x 1/4 degree from
> >> > http://www.nodc.noaa.gov/OC5/indprod.html
> >> >
> >> > The format is the same as 1 x 1 degree except for the 1440 x 720 in
> >> > stead of 720 x 360. of 1 x 1 degree.
> >> > The format discription is at
> >> > http://www.nodc.noaa.gov/OC5/readqd25.html
> >> >
> >> > I would like to calculate geostrophic current from 1/4 x 1/4 degree
> > WOA.
> >> >
> >> > What I thought is to use ferret by the way explained in the Chapter
> >> 2
> >> > of ASCII DATA/Reading ASCII files and saving by netcdf format.
> >> >
> >> > I wonder if this is best way for the large amount of data like WOA
> >> 1/4
> >> > x 1/4.
> >> > If there are better and easier way, I would like to know it.
> >> >
> >> > Best regards,
> >> >
> >> > Takaya Namba
> >> >
> >> >
> >>
> >
>
--
___________________________________________________
Jaison Kurian
Centre for Atmospheric and Oceanic Sciences
Indian Institute of Science
B A N G A L O R E 560 012
Ph: +91-80-3942505
+91-80-3600450
Fax:+91-80-3600865
___________________________________________________
\ cancel mode verify
!
! To read the WOA2001 1/4 X 1/4 temperature/salinity data (ASCII)
! available at http://www.nodc.noaa.gov/OC5/WOA01/qd_ts01.html
! and write it to a NetCDF file.
! This script expects input file names in the default way as
! t001_v2, t002_v2 .... or s001_v2, s002_v2.....
!
! Please start Ferret with more memory cache....like
! [user@machine]$ ferret -memsize 300mb
!----------------------------------------------------------
! select fields (temp or salinity) and the output filename
let prfx = "t" ! "t" for temperature and
! "s" for salinity
define symbol varname = temp ! output variable name
define symbol outfile = woa01_temp.nc ! output file name
define symbol vartitle= "WOA Temperature - Monthly Clim" ! title for var
define symbol varunits= "^oC" ! units for var
! ----NO NEED TO CHANGE ANYTHING BELOW----------------------
!
! define X, Y & Z axes according to the informations given at
! http://www.nodc.noaa.gov/OC5/readqd25.html
define axis/x=0.125:359.875:0.25/units=longitudes xlon
define axis/y=-89.875:89.875:0.25/units=latitudes ylat
let zdata = ZSEQUENCE({0, 10, 20, 30, 50, 75, 100, 125, 150,\
200, 250, 300, 400, 500, 600, 700, 800, 900, \
1000, 1100, 1200, 1300, 1400, 1500})
define axis/z/unit=meters/DEPTH/from_data zdepth=zdata
! define an "index" time axis ..we will put proper one later..
define axis/t=1:1:1 tax
! define a destination calendar time axis
define axis/t="15-JAN-0001:00":"15-DEC-0001:00":`365.2425/12`/\
units=days/t0="31-DEC-0000:00" time
! define grid for the file
define grid/x=xlon/y=ylat/z=zdepth/t=tax gfile
! construct the input ascii filename
let mon = XSEQUENCE({"01","02","03","04","05","06","07","08",\
"09","10","11","12"})
! open and read data for JAN
define symbol fname = `prfx`0`mon[i=1]`_v2
FILE/grid=gfile/COLUMS=10/FORMAT=(10(f8.4))/var=te ($fname)
set var/bad=-99.9999 te
! assign calendar axis to the variable
let tstamp = t[gt=time] * 0
let ($varname) = te[l=1] + tstamp
! write to output file
set var/title="`($vartitle)`"/units="`($varunits)`" ($varname)
fill/x=30:120/y=-30:30/k=1/l=1 ($varname)
sp rm -f ($outfile) ! to remove previous versions if any
SAVE/file=($outfile)/LLIMITS=1:12/L=1/CLOBBER ($varname)
cancel data 1
! repeat this process for other months
REPEAT/RANGE=2:12:1/NAME=mn ( ;\
define symbol mid = mon[i=`mn`] ;\
define symbol fname = `prfx`0`($mid)`_v2 ;\
define axis/t=`mn`:`mn`:1 tax ;\
FILE/grid=gfile/COLUMS=10/FORMAT=(10(f8.4))/var=te ($fname) ;\
set var/bad=-99.9999 te ;\
let ($varname)= te[t=`mn`] + tstamp ;\
SAVE/file=($outfile)/L=`mn`/APPEND ($varname) ;\
cancel data 1 ;\
say ; say " Month `mn` Over. " ; say ;\
)
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement