Re: HDF2NETCDF conversion

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Dec 24 2012 - 10:37:35 MST

As noted previously, the most important thing to do in
data processing is "look at your data". The original
hdf file had no indication of a missing value
(_FillValue or missing_value) or a valid range or
any other useful information. Thus, it is the user's
responsibilityto examine the file. It turns ou there was
a value that indicated _FillValue. The user
must set this if not on the file. The -1 and numbers
> 1.0 were outliers. They were set to _FillValue.

Use stat_dispersion to examine the data. Read the documentation.
 
http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml

It is particularly useful for examining satellite data.

;************************************************
; open file and read in data
;************************************************
   in = addfile("A-Dec2012-d01-1KM-Entire-CHL.nc","r")
   x = in->Mapped_Composited_mapped

;*********************************************
; Look at original data
;*********************************************
   printVarSummary(x)
  ;print("x: min="+min(x)+" max="+max(x))

   opt = True
   opt@PrintStat = True
   xstat = stat_dispersion(x, opt ) ; examine original data

;*********************************************
; Correct/Fix the data
;*********************************************

   if (.not.isatt(x,"_FillValue")) then
       x@_FillValue = -32767. ; manually set
   end if
   x = where(x.lt.0.0 , x@_FillValue, x) ; do not know what -1 is
   x = where(x.gt.1.0 , x@_FillValue, x) ; high outliers

See attachment

On 12/23/12 10:20 PM, kapilraj chakuri wrote:
> Hello,
>
> I tried the same. Here i am attaching the original png plotted using HDF file file and gif file plotted using nc file.
>
> I am using the NCL version 6.0.0
>
> regards,
> Raj
>
>
>
>
>
> ________________________________
> From: Dennis Shea <shea@ucar.edu>
> To: kapilraj chakuri <kapilraj_c@yahoo.co.in>
> Cc: ncl-talk@ucar.edu
> Sent: Sunday, 23 December 2012 8:14 PM
> Subject: Re: HDF2NETCDF conversion
>
>
> As mentioned is the previous email,
> *the file compression must be removed before NCL can be used*
>
> %> bunzip2 A-Dec2012-d01-1KM-Entire-CHL.hdf.bz2
>
> Did you do that?
>
> Then, you can use the generic tool: ncl_convert2nc
>
> %> ncl_convert2nc A-Dec2012-d01-1KM-Entire-CHL.hdf
>
> rather than the custom script. Did you try that?
> ----
> [1] There is nothing wrong with the custom script!
>
> The created file is at:
> ftp ftp.cgd.ucar.edu
> anonymous
> your email
> cd pub/shea/Misc
> get A-Dec2012-d01-1KM-Entire-CHL.nc
> quit
>
> The file is 233MB
>
> [2] You did not mention what was allegedly "wrong".
> How is ncl-talk to know ?
> What version of NCL are you using?
> %> ncl -V
>
> [3] It looks like you did not add any code to debug what is "wrong".
> Did you read the mini-Language manual to help you learn
> the language .... as suggested?
>
> As was mentioned before, *you* have to show some effort.
>
>
> On 12/23/12 7:02 AM, kapilraj chakuri wrote:
>> Hello,
>>
>> Can any body tell me how to convert HDF to NETCDF using ncl.I tried to convert but no very successful. Here i am attaching the script which was sent by shea to convert. But there is something wrong.
>>
>> I am very much new to NCL.
>>
>>
>> The hdf link file is below.
>>
>> http://www.incois.gov.in/WEBSITE_FILES/MODISA/CHL/dec2012/A-Dec2012-d01-1KM-Entire-CHL.hdf.bz2
>>
>>
>> Regards,
>> Raj
>>
>>
>>
>> _______________________________________________
>> 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 Mon Dec 24 10:37:53 2012

This archive was generated by hypermail 2.1.8 : Fri Jan 04 2013 - 15:32:29 MST