[ncl-talk] hdf5 file in ncl

Debasish Hazra debasish.hazra5 at gmail.com
Wed Nov 15 11:58:07 MST 2017


Thanks Mary. I am able to use the example to plot the variable.

Debasish

On Wed, Nov 15, 2017 at 12:06 PM, Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Debasish,
> See the first station data example here:
> http://www.ncl.ucar.edu/Applications/station.shtml
> Hope that helps!
> Adam
>
> On Wed, Nov 15, 2017 at 8:33 AM, Debasish Hazra <debasish.hazra5 at gmail.com
> > wrote:
>
>> Thanks Mary, adding "he2" suffix at the end helped. I have another
>> quaetion  to ask on this, how to assign 1 dimesnional lat and lon to the
>> variable field ? So far, I have :
>>
>>             oc_aod1 = w->Aerosol_Optical_Depth_Ocean_Aqua_AOD
>>
>>             lat1 = w->Latitude_Ocean_Aqua_AOD
>>             lon1 = w->Longitude_Ocean_Aqua_AOD
>>
>> PrintVarSummary of them :
>>
>> Variable: oc_aod1
>> Type: float
>> Total Size: 15116 bytes
>>             3779 values
>> Number of Dimensions: 1
>> Dimensions and sizes:   [Nobs_Ocean_Aqua_AOD | 3779]
>> Coordinates:
>> Number Of Attributes: 2
>>   _FillValue :  -999
>>   hdfeos_name : Aerosol_Optical_Depth
>> Variable: lat1
>> Type: float
>> Total Size: 15116 bytes
>>             3779 values
>> Number of Dimensions: 1
>> Dimensions and sizes:   [Nobs_Ocean_Aqua_AOD | 3779]
>> Coordinates:
>> Number Of Attributes: 4
>>   _FillValue :  -999
>>   hdfeos_name : Latitude
>>   units :       degrees_north
>>   long_name :   latitude
>> Variable: lon1
>> Type: float
>> Total Size: 15116 bytes
>>             3779 values
>> Number of Dimensions: 1
>> Dimensions and sizes:   [Nobs_Ocean_Aqua_AOD | 3779]
>> Coordinates:
>> Number Of Attributes: 4
>>   _FillValue :  -999
>>   hdfeos_name : Longitude
>>   units :       degrees_east
>>   long_name :   longitude
>>
>> Variable has one dimension, how do I make lat/lon grid for visualization ?
>>
>> Thanks.
>> Debasish
>>
>> On Tue, Nov 14, 2017 at 5:57 PM, Mary Haley <haley at ucar.edu> wrote:
>>
>>> Hi Debasish,
>>>
>>> This is an HDF-EOS2 file, which you can see if you do an ncl_filedump on
>>> the file and look at the top part of the output:
>>>
>>> Variable: f
>>> Type: file
>>> filename:       MYDAODHD.A2017305.0000.061.NRT
>>> path:   MYDAODHD.A2017305.0000.061.NRT.hdf
>>>    file global attributes:
>>>       HDFEOSVersion : HDFEOS_V2.19
>>>
>>> Try adding ".he2" to the end of the filename in your script. This will
>>> tell NCL to try opening the file as an HDF-EOS2 file:
>>>
>>>  diri = "./November2017/1/"
>>>  fili = "MYDAODHD.A2017305.0000.061.NRT.hdf.*he2*"
>>> ​ ​
>>> pthi = diri+fili
>>>  w = addfile(pthi,"r")
>>>
>>> It is not necessary to rename the file itself. The "addfile" command
>>> will first look for a file called "MYDAODHD.A2017305.0000.061.NRT.hdf.he2",
>>> and if it can't find that, it will look for the file "
>>> MYDAODHD.A2017305.0000.061.NRT.hdf", but will try to open it as an
>>> HDF-EOS2 file.
>>>
>>> Once you do this, the
>>> ​file will look much more reasonable.
>>>
>>> --Mary
>>>
>>> On Tue, Nov 14, 2017 at 2:20 PM, Debasish Hazra <
>>> debasish.hazra5 at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to read attached HDF5 file using ncl v6.4 but not able to
>>>> extract data attributes from "Group".
>>>>
>>>>  diri = "./November2017/1/"
>>>>      fili = "MYDAODHD.A2017305.0000.061.NRT.hdf"
>>>>
>>>>             pthi = diri+fili
>>>>             w = addfile(pthi,"r")
>>>>             mod1 = "Aerosol_Optical_Depth"
>>>>             Latitude = "Latitude"
>>>>             Longitude = "Longitude"
>>>>             print(mod1)
>>>>              gp = w->GeoField
>>>>
>>>> Variable: mod1
>>>> Type: string
>>>> Total Size: 8 bytes
>>>>             1 values
>>>> Number of Dimensions: 1
>>>> Dimensions and sizes:   [1]
>>>> Coordinates:
>>>> (0)     Aerosol_Optical_Depth
>>>> fatal:["Execute.c":6397]:variable (GeoField) is not in file (w)
>>>>
>>>> Not sure how to proceed with that. Any help is appreciated.
>>>>
>>>> Debasish
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726 <(303)%20497-1726>
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171115/df365fe2/attachment.html>


More information about the ncl-talk mailing list