Thanks for the reply. I have set my data as the format below:
190001.0 87.50 -157.50 -327.68 -327.68 -327.68 -327.68 -327.68 -327.68 -327.68
190001.0 87.50 -152.50 -327.68 -327.68 -327.68 -327.68 -327.68 -327.68 -327.68
........
the 1st column is yyyymm (float) and 2nd/3rd is lat/lon, the other right 12 colums is the value of Jan to Dec.
I use the code below to read it,But still can't get the right result.
(NCL use more than 95% of my xeon cpu,but fail to finish running)
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;*****************************************************
begin
filName = "Grid_PRCP_1900-2005_Ascii.dat"
nRow = numAsciiRow (filName)
nCol = 15
data = asciiread (filName, (/nRow,nCol/), "float")
printVarSummary(data) ; It seem that ncl stop here because the printVarSummary(data)
didn't give a output
yyyymm = floattointeger(data(:,0)) ; this convert float to integer
lats = data(0:2591,1) ; 36*72=2592 grids
lons = data(0:2591,2)
PRCP = data(:,3:)
PRCP!0 = 'lat'
PRCP!1 = 'lon'
PRCP!2 = 'time'
PRCP_at_lat = lats
PRCP_at_lon = lons
PRCP_at_time = ? ;I also want to know how to set time property of PRCP appropriately.
Thanks!
Lin
LEO_ARIES
2006-05-18
发件人: Dennis Shea
发送时间: 2006-05-17 03:59:11
收件人: Leo_Aries_at_tom.com
抄送:
主题: Re: [ncl-talk] How to read a 3-d ascii grid data file ?
>
>Thank you for your comment and help! I still have something need to know :
>
>
>[1] I would advise writing the ascii generated from fortran as:
>
> yyyymm lat lon jan feb .... dec
>
> This would give you 15 columns.
>
> the real format of yyyymm?
> Since all 12 monthly value in a year are
> written in one line,how to set the value of yyyymm?
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
filName = "..."
nRow = numAsciiRow (filName)
nCol = 15
data = asciiread (filName, (/nRow,nCol/), "float")
yyyymm = floattointeger(data(:,0))
^^^^^^^^^^^^^^^^^^^^^^^^ this convert float to integer
lats = data(:,1)
lons = data(:,2)
prc = data(:,3:)
>
>[2] comment: commonly netCDF uses only one time dimension
> eg: prc(lat,lon,time) or prc(time,lat,lon)
>
> If time has units yyyymm you can readily
> extract the yyyy and mm
>
> yyyy = time/100
> mm = time - yyyy*100
>
>? I'm not sure about the exact format of
>yyyy and mm.For example ,when refering to
>the Jan of 1901 , yyyymm=190101?
yes
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu May 18 2006 - 10:07:32 MDT
This archive was generated by hypermail 2.2.0 : Thu May 18 2006 - 15:57:32 MDT