<div dir="ltr"><div class="gmail_default" style="font-size:small">Paul,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks so much for providing a file. I was able to produce the same results as you, and I have reported it to the developers who will look into it.  I'm hoping we can get a fix in by the next release of NCL, which should be in March.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 26, 2015 at 3:42 AM, Steeven Paul Yerraguntla <span dir="ltr"><<a href="mailto:steevenpaul@gmail.com" target="_blank">steevenpaul@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Dear NCL users,</div><div class="gmail_default" style="font-size:small">                  Please see the attachments for the the file. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">regards</div><div class="gmail_default" style="font-size:small">     </div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 25, 2015 at 8:28 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Paul,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The output from print(gp) says that "gp" has 0 bytes. This means that NCL is failing when trying to read this variable:</div><span><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8000001907349px">Variable: gp</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Type: none</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Total Size: 0 bytes</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">            1 values</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Number of Dimensions: 0</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Dimensions and sizes:</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Coordinates:</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Number Of Attributes: 59</span><br></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8000001907349px"><br></span></div></span><div class="gmail_default" style="font-size:small"><span style="font-size:12.8000001907349px">I believe we have fixed this bug in the upcoming release of NCL.  Would you be able to provide us with the file so we can test it?</span></div><span><font color="#888888"><div class="gmail_default" style="font-size:small"><span style="font-size:12.8000001907349px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8000001907349px">--Mary</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8000001907349px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8000001907349px"><br></span></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 24, 2015 at 2:21 AM, Steeven Paul Yerraguntla <span dir="ltr"><<a href="mailto:steevenpaul@gmail.com" target="_blank">steevenpaul@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear NCL users<br>
Thanks to Griffin for good suggestions and i could convert the hdf to<br>
nc with the script provided by Dennis long ago and the problems is the<br>
iteration is done only to the first file in the loop and the error<br>
occuring with the message "segmentation fault (core dumped)". I run<br>
the script again using the command ncl -x filename.ncl and the output<br>
as follows. Please let me know how can i get the iteration completed.<br>
<br>
***********************************************************************************<br>
 Copyright (C) 1995-2012 - All Rights Reserved<br>
 University Corporation for Atmospheric Research<br>
 NCAR Command Language Version 6.1.0<br>
 The use of this software is governed by a License Agreement.<br>
 See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br>
+ ;************************************************<br>
+ ; Allways examine file contents:<br>
+ ; %> ncl_filedump foo.h5 | less<br>
+ ;************************************************<br>
Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
+<br>
Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
+<br>
Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
+<br>
+ ;************************************************<br>
+   begin<br>
+   diri = "./"<br>
+   diroxx = "./"<br>
+<br>
+   fili = systemfunc("cd "+diri+" ; ls *.h5")<br>
+   nfil = dimsizes(fili)<br>
+   print("nfil="+nfil)<br>
+<br>
+   do nf=0,nfil-1<br>
+      print("===========================")<br>
+      f    = addfile(diri+fili(nf), "r")<br>
+        Latitude  = f->/OLR/OLR_Dataset.Latitude<br>
+        Longitude = f->/OLR/OLR_Dataset.Longitude<br>
+<br>
+   print("---")<br>
+   printVarSummary(Latitude)                            ; [DIM_000 | 250601]<br>
+   print("Latitude: min="+min(Latitude)+"   max="+max(Latitude))<br>
+   print("---")<br>
+   printVarSummary(Longitude)                           ; [DIM_000 | 250601]<br>
+   print("Longitude: min="+min(Longitude)+"   max="+max(Longitude))<br>
+   print("---")<br>
+  ;print(Latitude+"   "+Longitude)<br>
+   print("---")<br>
+<br>
+   gp    = f->GP_PARAM_INFO                   ; read group<br>
+   print(gp)<br>
+   print("---")<br>
+<br>
+   latS  = gp@ValidBottomLat<br>
+   latN  = gp@ValidTopLat<br>
+   lonL  = gp@ValidLeftLon<br>
+   lonR  = gp@ValidRightLon<br>
+<br>
+   dlat  = gp@LatInterval<br>
+   nlat  = toint((latN-latS)/dlat)+1<br>
+   lat   = fspan(latS, latN, nlat)<br>
+   lat!0 = "lat"<br>
+   lat@units = "degrees_north"<br>
+<br>
+   dlon  = gp@LonInterval<br>
+   mlon  = toint((lonR-lonL)/dlon)+1<br>
+   lon   = fspan(lonL, lonR, mlon)<br>
+   lon!0 = "lon"<br>
+   lon@units = "degrees_east"<br>
+<br>
+  ;OLR = f->/OLR/OLR_Dataset.OLR<br>
+  ;printVarSummary(OLR)              ; [DIM_000 | 250601]<br>
+<br>
+   olr     = onedtond( f->/OLR/OLR_Dataset.OLR, (/nlat,mlon/) )<br>
+   olr!0   = "lat"<br>
+   olr!1   = "lon"<br>
+   olr&lat =  lat<br>
+   olr&lon =  lon<br>
+ ;;olr@long_name = gp@GP_PARAM_NAME<br>
+ ;;olr@units     = gp@OLR_Unit<br>
+   olr@long_name = "OLR"<br>
+   olr@units     = "W/m^2"<br>
+<br>
+   print("typeof(gp@MissingValueInProduct="+typeof(gp@MissingValueInProduct))<br>
  ; type double<br>
+<br>
+   olr@_FillValue= tofloat(gp@MissingValueInProduct)  ; match olr type<br>
+<br>
+   printVarSummary(olr)<br>
+   print("olr: min="+min(olr)+"   max="+max(olr))<br>
+   print("---")<br>
+<br>
+ ;************************************************<br>
+ ; Examine distribution<br>
+ ;************************************************<br>
+<br>
+   opt = True<br>
+   opt@PrintStat = True<br>
+   stat = stat_dispersion(olr, opt )<br>
+<br>
+     print("---")<br>
+      fbase = str_get_field(fili(nf),1,".")<br>
+      print("fbase="+fbase)<br>
+<br>
+      diro = "./"<br>
+      filo = fbase+".nc"<br>
+      ptho = diro+filo<br>
+<br>
+      system("/bin/rm -f "+ptho) ; remove any pre-existing file<br>
+      ncdf = addfile(ptho ,"c")  ; open output netCDF file<br>
+<br>
+                                           ; create global attributes<br>
of the file<br>
+      fAtt               = True            ; assign file attributes<br>
+      fAtt@title         = "NCL: H5 to netCDF"<br>
+      fAtt@source        = "MOSDAC: Meteorological & Oceanographic<br>
<span>Satellite Data Archival Center (India)"<br>
</span>+      fAtt@source_file   =  fili(nf)<br>
+      fAtt@Conventions   = "None"<br>
+      fAtt@creation_date = systemfunc ("date")<br>
<span>+      fileattdef( ncdf, fAtt )            ; copy file attributes<br>
</span>+<br>
+      ncdf->OLR = olr<br>
+   end do<br>
+  end<br>
<span>(0)     nfil=31<br>
(0)     ===========================<br>
(0)     ---<br>
<br>
</span>Variable: Latitude<br>
Type: float<br>
Total Size: 1002404 bytes<br>
            250601 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes:   [DIM_000 | 250601]<br>
Coordinates:<br>
Number Of Attributes: 0<br>
(0)     Latitude: min=-60   max=60<br>
(0)     ---<br>
<br>
Variable: Longitude<br>
Type: float<br>
Total Size: 1002404 bytes<br>
            250601 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes:   [DIM_000 | 250601]<br>
Coordinates:<br>
Number Of Attributes: 0<br>
(0)     Longitude: min=10   max=140<br>
(0)     ---<br>
(0)     ---<br>
<br>
<br>
Variable: gp<br>
Type: none<br>
Total Size: 0 bytes<br>
            1 values<br>
Number of Dimensions: 0<br>
Dimensions and sizes:<br>
Coordinates:<br>
Number Of Attributes: 59<br>
  BinningInput_01 :     K1VHR_05OCT2013_0000<br>
  .<br>
  .<br>
  .<br>
  BinningInput_44 :     K1VHR_05OCT2013_2330<br>
  BinningTime : 2330R_05OCT2013_2330<br>
  GP_PARAM_DESCRIPTION :        Daily_05OCT2013_2330<br>
  GP_PARAM_NAME :       Outgoing Longwave Radiation (OLR)<br>
  Input_Channels :      TIR<br>
  LatInterval : 0.25<br>
  Latitude_Unit :       Degrees<br>
  LonInterval : 0.25<br>
  Longitude_Unit :      Degrees<br>
  MissingValueInProduct :        999<br>
  NoOfBinningInputs :   44<br>
  OLR_Unit :    Watts/sq. met.<br>
  ValidBottomLat :       -60<br>
  ValidLeftLon :          10<br>
  ValidRightLon :        140<br>
  ValidTopLat :   60<br>
(0)     ---<br>
(0)     typeof(gp@MissingValueInProduct=double<br>
<br>
Variable: olr<br>
Type: float<br>
Total Size: 1002404 bytes<br>
            250601 values<br>
Number of Dimensions: 2<br>
Dimensions and sizes:   [lat | 481] x [lon | 521]<br>
Coordinates:<br>
            lat: [ -60..  60]<br>
            lon: [  10.. 140]<br>
Number Of Attributes: 3<br>
  _FillValue :  999<br>
  units :       W/m^2<br>
  long_name :   OLR<br>
(0)     olr: min=110.786   max=343.597<br>
(0)     ---<br>
(0)<br>
(0)        ===> Robust Dispersion Statistics: OLR <===<br>
(0)      [0]            Mean=254.263<br>
 .<br>
 .<br>
 .<br>
(0)      [29]       Kurtosis=-0.392987<br>
(0)<br>
(0)     ---<br>
(0)     fbase=K1VHR_05OCT2013_DAILY_L03_OLR<br>
(0)     ===========================<br>
(0)     ---<br>
<br>
Variable: Latitude<br>
Type: float<br>
Total Size: 1002404 bytes<br>
            250601 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes:   [DIM_000 | 250601]<br>
Coordinates:<br>
Number Of Attributes: 0<br>
(0)     Latitude: min=-60   max=60<br>
(0)     ---<br>
<br>
Variable: Longitude<br>
Type: float<br>
Total Size: 1002404 bytes<br>
            250601 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes:   [DIM_000 | 250601]<br>
Coordinates:<br>
Number Of Attributes: 0<br>
(0)     Longitude: min=10   max=140<br>
(0)     ---<br>
(0)     ---<br>
Segmentation fault (core dumped)<br>
**************************************************************************<br>
<br>
regards<br>
Paul.<br>
<div><div><br>
On 2/24/15, Kyle Griffin <<a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a>> wrote:<br>
> Look at what the error message is telling you. In this case, it says<br>
> "variable OLR1 is undefined" - which is your problem. OLR1 does not exist<br>
> anywhere else in your script! It appears you are trying to write it out to<br>
> the output file correctly, but there is no data to output because you never<br>
> read that variable in!<br>
><br>
> Some info on reading (and writing, but that's not relevant for you at the<br>
> moment) HDF5 files is available here:<br>
><br>
> <a href="http://www.ncl.ucar.edu/Applications/hdf5.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/hdf5.shtml</a><br>
><br>
> It is not the most organized of pages, but you can get the general gist of<br>
> things if you have a more complicated HDF5 file with groups. Otherwise,<br>
> note that the typical notation for reading in a variable from file(s) is<br>
> like this, using your code from above:<br>
><br>
> f    = addfile(diri+fili(nf), "r")     ;same as above<br>
> OLR1 = f->OLR_var_name    ;change to match the variable name desired from<br>
> your file<br>
><br>
> You may need/want other coordinate variables from the file as well. I don't<br>
> have much experience with HDF5 myself, but if you have some issues, you can<br>
> look into resolving them with some tips from the general file I/O page as<br>
> well:<br>
><br>
> <a href="http://www.ncl.ucar.edu/Applications/list_io.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/list_io.shtml</a><br>
><br>
> Please respond back to the list if you have more questions!<br>
><br>
><br>
> Kyle<br>
><br>
> ----------------------------------------<br>
> Kyle S. Griffin<br>
> Department of Atmospheric and Oceanic Sciences<br>
> University of Wisconsin - Madison<br>
> Room 1421<br>
> 1225 W Dayton St, Madison, WI 53706<br>
> Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a><br>
><br>
> On Mon, Feb 23, 2015 at 10:56 PM, Steeven Paul Yerraguntla <<br>
> <a href="mailto:steevenpaul@gmail.com" target="_blank">steevenpaul@gmail.com</a>> wrote:<br>
><br>
>> Dear NCL users,<br>
>>           I wanted to convert number of OLR hdf(.h5) files to netcdf<br>
>> files<br>
>> and to get it done i used the following script and facing error at the<br>
>> line<br>
>> marked in the following script. I could not make out how to solve it.<br>
>> Please help me in solving out it.  Thanks in advance.<br>
>><br>
>> =================================================================<br>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
>> ;************************************************<br>
>>   begin<br>
>>   diri = "./"<br>
>>   diro = "./"<br>
>><br>
>>   fili = systemfunc("cd "+diri+" ; ls *.h5")<br>
>>   nfil = dimsizes(fili)<br>
>>   print("nfil="+nfil)<br>
>><br>
>>   do nf=0,nfil-1<br>
>>      print("===========================")<br>
>>     f    = addfile(diri+fili(nf), "r")<br>
>><br>
>>      print("---")<br>
>>      fbase = str_get_field(fili(nf),1,".")<br>
>>      print("fbase="+fbase)<br>
>><br>
>>      diro = "./"<br>
>>      filo = fbase+".nc"<br>
>>      ptho = diro+filo<br>
>><br>
>>      system("/bin/rm -f "+ptho) ; remove any pre-existing file<br>
>>      ncdf = addfile(ptho ,"c")  ; open output netCDF file<br>
>><br>
>>                                           ; create global attributes of<br>
>> the file<br>
>>      fAtt               = True            ; assign file attributes<br>
>>      fAtt@title         = "NCL: H5 to netCDF"<br>
>>      fAtt@source        = "MOSDAC: Meteorological & Oceanographic<br>
>> Satellite Data Archival Center (India)"<br>
>>      fAtt@source_file   =  fili(nf)<br>
>>      fAtt@Conventions   = "None"<br>
>>      fAtt@creation_date = systemfunc ("date")<br>
>>      fileattdef( ncdf, fAtt )            ; copy file attributes<br>
>><br>
</div></div>>>     *ncdf->OLR = OLR1     <==============  This is where error is<br>
>> occuring*<br>
>>   end do<br>
>>  end<br>
>> =====================================<br>
>> *Error message as follows:*<br>
<span>>><br>
>> (0) nfil=31<br>
>> (0) ===========================<br>
>> (0) ---<br>
>> (0) fbase=K1VHR_05OCT2013_DAILY_L03_OLR<br>
>> fatal:Variable (OLR1) is undefined<br>
>> fatal:["Execute.c":7743]:Execute: Error occurred at or near line 41 in<br>
>> file nfiles_conversion_h5_to_nc.ncl<br>
>><br>
>> _______________________________________________<br>
>> ncl-talk mailing list<br>
>> List instructions, subscriber options, unsubscribe:<br>
>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>><br>
>><br>
><br>
<br>
<br>
</span>--<br>
<br>
<br>
<br>
<br>
*<br>
***<br>
<div><div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>