X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 21 Apr 2016 12:59 PM by  anon
Help using netcdf_get
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



Basic Member


Posts:143
Basic Member


--
21 Apr 2016 12:59 PM
    An IDL user has asked the following question: I am trying to understand how to read in a netcdf file using “ndcf_get,’2015_1.nc’,’u’,output.” It seems to read it in and gives me the array u() information. I cannot understand the jargon relating to Hash. I just want to use the data u() in a pro. Help.

    Deleted User



    Basic Member


    Posts:143
    Basic Member


    --
    21 Apr 2016 01:10 PM
    Hashes are data structures that store data and allow you to access it using keys. Below is an example how to access the data from a NetCDF file using ncdf_get and hash syntax: IDL> f = file_which('sample.nc') IDL> ncdf_get, f, 'image', result IDL> image_hash = result["image"] IDL> image_hash.keys() [ "dim_names", "value", "dim_sizes", "attributes" ] IDL> data = image_hash["value"] IDL> help, data DATA BYTE = Array[768, 512] IDL> i = image(data) If you don't want to use hashes, you could also use the STRUCT keyword and use structures instead. An example of this is shown below: IDL> ncdf_get, f, 'image', result2, /STRUCT Reading image: BYTE(768,512) . . . IDL> help, result2 ** Structure , 2 tags, length=393304, data length=393304, refs=1: CREATED STRING ' Created on Thu Apr 21 12:59:33 2016' IMAGE STRUCT -> Array[1] IDL> img_struct = result2.IMAGE IDL> help, img_struct ** Structure , 4 tags, length=393288, data length=393288, refs=2: DIM_NAMES STRING Array[2] VALUE BYTE Array[768, 512] DIM_SIZES LONG Array[2] ATTRIBUTES STRUCT -> Array[1] IDL> data = img_struct.value IDL> i = image(data) I hope this will be helpful. David Starbuck Harris Geospatial Solutions
    You are not authorized to post a reply.