comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Point Observations from NARR output
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Point Observations from NARR output [message #75757] Thu, 07 April 2011 13:25
B.J. Baule is currently offline  B.J. Baule
Messages: 3
Registered: April 2011
Junior Member
Hello all,

This is probably a really simple problem however my inexperience
with IDL has left me baffled. I'm relatively new to IDL programming
and have a question regarding getting grid point values from NARR
reanalysis output. I can get the data to open, read in, and make a
map. However, I would like to get point observations from the
reanalysis data set (Ex. July Temperature for Barrow, AK Lat:
71.2905556 Lon:-156.7886111).

The three variables that I've pulled from the netCDF file file are
air temp (air), latitude, longitude. With the HELP function in IDL, I
find that the dimensions of the arrays are: air = ARRAY[349, 277, 12],
rlats = ARRAY[349,277], rlons = ARRAY[349,277]. As I understand it,
the Lambert Conformal Conic Grid is a 349x277 grid. It has been
suggested to me that I should be working in x y coordinates. When I
try and pull x and y from the netcdf file, I get arrays but they are
both 277 element single dimension arrays. I'd expected the x array to
be 349 elements and y to be 277 elements. If I could get a 349 element
x array and a 277 element y array, then maybe I could use
MAP_PROJ_INVERSE to get lat lon values for these grid points?

Sorry if this is an elementary question that has an easy solution
that I'm overlooking. Does anyone have experience doing this? Any help
would be greatly appreciated.

Thanks,
B.J.


(I've attached a copy of the code I've tried to build, sorry about the
lack of comments):

PRO TRYIT_XY

Compile_Opt defint32
;define number of latitudes/longitudes
nlons=349
nlats=277

vararray2 = fltarr(nlons,nlats)
vararray = fltarr(nlons,nlats,12)
vararryin = fltarr(nlons,nlats)
rlons = fltarr(nlons,nlats)
rlats = fltarr(nlons,nlats)

;Open file get variable id's
infile = '/Users/snr-wbaule/Desktop/Reanalysis_Data/air.2m.mon.ltm.nc '
nunit = ncdf_open(infile,/nowrite)
ivarid = ncdf_varid(nunit,'air')
ilatid = ncdf_varid(nunit,'y')
ilonid = ncdf_varid(nunit,'x')

;Get scale and offset attributes from netCDF file
NCDF_ATTGET,nunit,'air','add_offset', add_offset
NCDF_ATTGET,nunit,'air','scale_factor',xscale

; apply offset and scale factor to air temp data for all months
for itime = 0,11,1 do begin
offset = [0,0,itime]
count = [nlons,nlats,1]

ncdf_varget,nunit,ivarid,temp, OFFSET=offset
vararray[*,*,itime] = vararray2 + (xscale*FLOAT(temp)) + add_offset


endfor
; get lat and lon arrays from file
ncdf_varget,nunit,ilatid,rlats,OFFSET=[0,0],$
count = [nlons,nlats]
ncdf_varget,nunit,ilonid,rlons,OFFSET=[0,0],$
count = [nlons,nlats]

HELP, vararray ,rlats, rlons

;reproject data with parameters found in netCDF file
result = MAP_PROJ_INIT(104, CENTER_LATITUDE=0,
CENTER_LONGITUDE=-107,STANDARD_PAR1=50.0,$
STANDARD_PAR2=50.0, DATUM=8, /GCTP, LIMIT=[12.2, -133.5, 54.5, -152.,
57.3, -49.4, 14.3,-65.1]); FALSE_EASTING=5632642.22547,
FALSE_NORTHING=4612545.65137)
;convert to x y
result2 = MAP_PROJ_FORWARD(rlons, rlats, MAP_STRUCTURE=result)
;convert x y to lat lon to check values.
result3 = MAP_PROJ_INVERSE(result2, MAP_STRUCTURE=result)


END
[Message index]
 
Read Message
Previous Topic: Re: It's here, and it's beautiful
Next Topic: Re: Point Observations from NARR output

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:09:31 PDT 2025

Total time taken to generate the page: 0.00418 seconds