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

Home » Public Forums » archive » How to Write Data to File with Particular Dimension Values?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
How to Write Data to File with Particular Dimension Values? [message #80426] Sat, 02 June 2012 10:41
John Doe is currently offline  John Doe
Messages: 1
Registered: June 2012
Junior Member
This is a very basic question but I can't find the answer online.

I have a 2-dimensional (100x100) array holding landcover codes, and I
want to write it out to a NetCDF file so that the landcover codes are
indexed by lat/lng pairs. Right now I use just a single NCDF_VARPUT
and it works except in the resulting NetCDF file the landcover code is
indexed from 0 to 99. I guess this is because my IDL array itself is
indexed only from 0 to 99, and has no association with lat/lng pairs.
How do I write it out so that each array element is associated with a
specific lat/lng pair?

My code right now:

file_id = NCDF_CREATE('landcover.nc')
NCDF_CONTROL, file_id, /FILL
lng_id = NCDF_DIMDEF(file_id, 'lng', 100)
lat_id = NCDF_DIMDEF(file_id, 'lat', 100)
landcover_id = NCDF_VARDEF(file_id, 'landcover', [lng_id, lat_id], /
SHORT)
NCDF_CONTROL, file_id, /ENDEF
NCDF_VARPUT, file_id, landcover_id, myArray
NCDF_CLOSE, file_id

Thanks.
[Message index]
 
Read Message
Previous Topic: Re: Operator precedence flipflop?
Next Topic: Texture Map problems when using IDLgrPolygon

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

Current Time: Wed Oct 08 15:36:15 PDT 2025

Total time taken to generate the page: 0.00433 seconds