linint2_points for station data

From: yanling_1220 <yanling_1220_at_nyahnyahspammersnyahnyah>
Date: Wed, 8 Jul 2009 21:58:24 +0800 (CST)

Hello,

I'm new in NCL language, so I'm having some difficulties in doing things that
seems to be easy!

I have used linint2_points_Wrap( )to interpolate a monthly surface air temperature(tas) data projected by ECHAM5/MPI-OM from one gussian grid ntim *nlat* mlon() (ntim=260, nlat=96, mlon=192)to 747 stations in my research area.As explanation of linint2_points_Wrap function on http://www.ncl.ucar.edu/Document/Functions/Built-in/linint2_points.shtml,the returned array is ofDimensions and sizes: [time | 360] x [pts | 747]. And I think the interpolate process succeed.
I consider that the returned arrays are 360D arrays of length 747 containing the interpolated values for each(x0,y0)coordinate pair, it is to say that at each time£¬there are only 747 discrete points with values. And the data is (360,747*747),not (360,747,747)as before.So can time series analysis be done in NCL base on the returned array£¬such as Computeing the long term monthly means ¡¢seasonal means¡¢annual values£¬and so on. If these can come true, what are the corresponding functions? The functions that process the data such as (360,747,747)can process the data such as(360,747*747)? If it can¡¯t ,what about using onedtond( ndtooned(FO),(/ntim,N,M/))to reshape the? returned arrays FO ?
Above all, I wanted to contrast the interpolated project data with my station observation. My station data is storaged in an ASCII file as below frame£º
Year month stid lat lon tas.
I want to obtain the time and spatial correlativity between the two data set, or regress correlation between peojected and observerd data . But I have no idea about how to do it in ncl. Can I read the sation data into ncl according to some format that is convenient for analysis, and how should I to do it?
Or If I have to put the interpolated project data out to carry out the analysis, and? how can I gain the data in the sameframe as the station observation. I have tried to put interpolated project data out as .nc file, and define the content of the entire file as below:
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/contributed.ncl"
begin
stain= asciiread("station.asc",(/747,2/), "float")??
printVarSummary(stain )
LAT = stain(:,0)????????????? ; (N,M)
LON = stain(:,1)??
fo = linint2_points_Wrap(lon,lat,orig,True,LON,LAT,0) ;fo(ntim,747*747)
ntim? = dimsizes(time)
tas = onedtond(ndtooned(fo),(/ntim,747,747/))??
printVarSummary(tas)
?
tas!1 = "lat"
tas!2 = "lon"
lat = tas&lat
lon = tas&lon
nlat? = dimsizes(lat)
nlon? = dimsizes(lon)?
?
cn_filename2 = "tas_run1_linint2_points.nc"
system("/bin/rm -f " + cn_filename2)
fout= addfile(cn_filename2,"c")
setfileoption(fout,"DefineMode",True)
fileAtt?????????????? = True???????????????
fileAtt_at_title???????? = "data from linint2_points"??
fileAtt_at_conventions?? = "None"??
fileAtt_at_date????????? = systemfunc("date")???
fileattdef(fout,fileAtt)??????? ?????????
?
dimNames = (/"time","lat","lon"/)
dimSizes = (/ntim,nlat,nlon/)?
dimUnlim = (/False,False,False/)
filedimdef(fout,dimNames,dimSizes,dimUnlim)
?
filevardef(fout, "time" ,typeof(time),getvardims(time))??????????????????????????
filevardef(fout, "lat"? ,typeof(lat),getvardims(lat))??????????????????????????
filevardef(fout, "lon"? ,typeof(lon),getvardims(lon))??
filevardef(fout, "tas"? ,typeof(tas),getvardims(tas))
?
filevarattdef(fout,"time" ,time)????????????? ; copy T attributes
filevarattdef(fout,"lat"? ,lat)?????????????? ; copy Y attributes
filevarattdef(fout,"lon"? ,lon)?????????????? ; copy X attributes
filevarattdef(fout,"tas"? ,tas)?????????? ; copy tas attributes
?
fout->time??? = (/time/)????
fout->lat???? = (/lat/)
fout->lon???? = (/lon/)
fout->tas???? =(/tas/)
end
I got an error massage:
fatal:No coordinate variable exists for dimension (lat) in variable (tas)
It means the named dimensions ¡°tas!1 = "lat", tas!2 = "lon"¡± isn¡¯t working.In the ¡°language_man_MINI.pdf¡±, it said that ¡°Named dimensions should only be used when dimension reordering is required.¡±? But if I want to put the interpolated result out, what should I define the latitude/longitude arrays?
Wish I have a clear show of my problems with my poor English.
If anybody knows how I should proceed the problem or finds the mistakes that I have made whether in the process or about the comprehension, please let me know, thanks!!!

Regards,

Sunflowers

?

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 08 2009 - 07:58:24 MDT

This archive was generated by hypermail 2.2.0 : Mon Jul 13 2009 - 20:56:19 MDT