Re: reading hdf5 data problem

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 05 2013 - 09:27:23 MDT

sk,

We have fixed the problem related to read the h5 you have used.
The fix will be in the next release.
If you want a new binary before the next release, please let us know.

Attached are a sample script, and a png file generated from the script.

Thanks,

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

----------------
 setfileoption("nc", "FileStructure", "Advanced")

 f = addfile("MSG3-SEVI-MSG15-0100-NA-20130521001244.164000000Z-1074164.h5", "r")

;print(f)
;id = f->IMAGE_DATA
;palette = f->Palette

 iname = "/U-MARF/MSG/Level1.5/DATA/Channel 07/IMAGE_DATA"
 pname = "/U-MARF/MSG/Level1.5/DATA/Channel 07/Palette"
 id = f->$iname$
 palette = f->$pname$

;printVarSummary(id)
;print("min(id) = " + min(id) + ", max(id) = " + max(id))

;printVarSummary(palette)
;print("min(palette) = " + min(palette) + ", max(palette) = " + max(palette))

 fid = tofloat(id)

 wks = gsn_open_wks("png","raster") ; open a ps file
 res = True ; plot mods desired
 res@cnFillOn = True ; color Fill
 res@cnFillMode = "RasterFill" ; Raster Mode
 res@cnLinesOn = False ; Turn off contour lines
 res@cnLineDrawOrder = "Predraw" ; Draw lines and filled
 res@cnFillDrawOrder = "Predraw" ; areas before map gets set
 res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
 res@cnMinLevelValF = min(fid) ; set min contour level
 res@cnMaxLevelValF = max(fid) ; set max contour level
 res@cnLevelSpacingF = 10.0 ; set contour spacing

 colors = tofloat(palette)/255.0
 gsn_define_colormap(wks,colors)
 plot = gsn_csm_contour(wks,fid, res) ; create plot

--------------------

On Sep 5, 2013, at 12:07 AM, sk <sdk0084@yahoo.com> wrote:

> i can give you IDL example:
>
> ; Open the HDF5 file.
> file = FILEPATH('hdf5_test.h5', $
> SUBDIRECTORY=['examples', 'data'])
> file_id = H5F_OPEN(file)
> ; Open the image dataset within the file.
> ; This is located within the /images group.
> ; We could also have used H5G_OPEN to open up the group first.
> dataset_id1 = H5D_OPEN(file_id, '/images/Eskimo')
> ; Read in the actual image data.
> image = H5D_READ(dataset_id1)
> ; Open up the dataspace associated with the Eskimo image.
> dataspace_id = H5D_GET_SPACE(dataset_id1)
> ; Retrieve the dimensions so we can set the window size.
> dimensions = H5S_GET_SIMPLE_EXTENT_DIMS(dataspace_id)
> ; Now open and read the color palette associated with
> ; this image.
> dataset_id2 = H5D_OPEN(file_id, '/images/Eskimo_palette')
> palette = H5D_READ(dataset_id2)
> ; Close all our identifiers so we don't leak resources.
> H5S_CLOSE, dataspace_id
> H5D_CLOSE, dataset_id1
> H5D_CLOSE, dataset_id2
> H5F_CLOSE, file_id
> ; Display the data.
> DEVICE, DECOMPOSED=0
> WINDOW, XSIZE=dimensions[0], YSIZE=dimensions[1]
> TVLCT, palette[0,*], palette[1,*], palette[2,*]
> ; Use /ORDER since the image is stored top-to-bottom.
> TV, image, /ORDER
>
> -SK
>
> From: Wei Huang <huangwei@ucar.edu>
> To: sk <sdk0084@yahoo.com>
> Cc: ncl <ncl-talk@ucar.edu>
> Sent: Thursday, September 5, 2013 7:05 AM
> Subject: Re: reading hdf5 data problem
>
> SK,
>
> We are getting closer to figure out the problem.
> We have been able to read out "IMAGE_DATA",
> and "Palette". We checked the web-site you pointed,
> but do not know how Palette is mapped to IMAGE_DATA.
> Do you know how IMAGE_DATA are indexed to Palette?
>
> We have noticed IMAGE_DATA has range from 0 - 628,
> and Palette ranges from 0 - 255. HDFVIEW shown as
> a black-white image.
>
> Thanks for any info can help us understand the data,
>
> Wei
>
> huangwei@ucar.edu
> VETS/CISL
> National Center for Atmospheric Research
> P.O. Box 3000 (1850 Table Mesa Dr.)
> Boulder, CO 80307-3000 USA
> (303) 497-8924
>
>
>
>
>
>
> On Sep 2, 2013, at 7:39 AM, sk <sdk0084@yahoo.com> wrote:
>
>> Hi There,
>> I have a problem to open HRI SEVIRI level 1.5 hdf5 files. ncl simply gives segmentation error whenever i try to open a file. i have tried different versions of ncl binaries and always the result was the same. so my question is: does ncl binaries support hdf5 format? or maybe i should compile the code with hdf5 libs?
>> the data itself are OK. i have seen them in hdfview.
>> Regards,
>> SK
>>
>> p.s.
>> the description of the dataset: http://navigator.eumetsat.int/discovery/Start/DirectSearch/DetailResult.do?f%28r0%29=EO:EUM:DAT:MSG:HRSEVIRI
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 5 09:27:41 2013

This archive was generated by hypermail 2.1.8 : Mon Sep 16 2013 - 13:43:52 MDT