<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>