[Thread Prev][Thread Next][Index]

[ferret_users] Converting ASCII data to netCDF file



Dear ferret users,

I'm not sure if this question is already asked and answered by ferret users. I couldn't access the ferret mailing list. It redirects to ferret manual.

I have regularly-spaced text data and want to convert it to netcdf file. The data is decadal (average of 10 days) so each month consisting of three time steps.
I wrote the following script and it worked fine, but the time axis is not correct.
let ntime = 180
let Variables = "Lon,Lat,Time,pr"
DEFINE AXIS/X=33.75:40.25:0.1/UNITS=degrees_east xaxis
DEFINE AXIS/Y=7.25:14.95:0.1/UNITS=degrees_north yaxis
DEFINE AXIS/EDGEDS/T=06-JAN-1983:26-DEC-1987:10/UNITS=days taxis
DEFINE GRID/X=xaxis/Y=yaxis/T=taxis xytgrid
FILE/FORMAT=delim/skip=1/VAR=`Variables`/GRID=xytgrid Rain83-87.txt
save/file=Test-gridded-1983-1987.nc pr[g=xytgrid@asn]

use Test-gridded-1983-1987.nc
sh d

list pr[i=1,j=1,l=1:180]
11-JAN-1983 00 /   1:    0.0
 21-JAN-1983 00 /   2:    0.0
 31-JAN-1983 00 /   3:    1.0
 10-FEB-1983 00 /   4:   12.0
 20-FEB-1983 00 /   5:    0.0
 02-MAR-1983 00 /   6:    0.0
 12-MAR-1983 00 /   7:    1.0
 22-MAR-1983 00 /   8:    5.0
 01-APR-1983 00 /   9:   16.0
 11-APR-1983 00 /  10:   19.0
 21-APR-1983 00 /  11:   11.0
            :
            :
            :
As you can see "Feb" consists two time steps instead of three. Could someone help me in creating the correct time axis? I also would like to compute the monthly mean from a decadal data.
Please see attached. The structure of the data is [lon, lat, time, var].


Thanks,
Hussen

--
Hussen Seid Endris
PhD Student
Climate System Analysis Group
Department of Environmental and Geographical Science
University of Cape Town
Private Bag Rondebosch, 7701, Cape Town, South Africa
Tel:(+27) (0)74 222 4357

Attachment: Rain83-87.txt.tar.gz
Description: GNU Zip compressed data


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement