[ncl-talk] ncl-talk Digest, Vol 130, Issue 1

Alessandra Giannini alesall at iri.columbia.edu
Tue Sep 2 05:15:13 MDT 2014


you need to continue to edit your script to adapt to your specific need…
What is the variable that  you want to plot? If it's not called "latentHeat" what is it called?
Then substitute just like you did for lat and lon…




On Sep 2, 2014, at 7:10 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:

>    Hi
> I have correctec the lines 34 and 35. of my file.
> 
> 1 ;Reading HDF4-SDS files
>       2 ;*********** Load Libraries ************************************
>       3 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>       4 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>       5 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>       6 ;**************************************************************
>       7 begin
>       8 ;***************************************************************
>       9 ; User Input
>      10 ;***************************************************************
>      11                                              ; INPUT
>      12    diri    = "./"                            ; input directory
>      13    fili    = "2A12.20100702.71931.7.HDF"       ;       file
>      14    var     = "latentHeat"                    ; desired variable
>      15
>      16                                              ; OUTPUT
>      17    PLOT    = True                            ; create a plot [?]
>      18    pltDir  = "./"                            ; directory for plot output
>      19   ;pltName = "2A12.100702.71931.6"           ; plot name
>      20    pltName = "hdf4sds"                       ; plot name
>      21    pltType = "ps"                            ; ps, pdf, x11, png [5.2.0]                                                                                                                              
>      22 ;***************************************************************
>      23 ; End User Input
>      24 ;***************************************************************
>      25 ; Read hdf
>      26 ;***************************************************************
>      27
>      28    f      = addfile (diri+fili, "r")        ; reading inputfile
>      29   ;print(f)
>      30
>      31    lat  = f->Latitude(:,:)                 ; (scan, pixel)
>      32    lon  = f->Longitude(:,:)
>      33
>      34    lat at units = "degrees_north"             ; add units
>      35    lon at units = "degrees_east"
>      36
>          37   printMinMax(lat, True)
>      38   printMinMax(lon, True)
>      39
>      40    xs     = f->$var$                       ; ( scan, pixel, layer )
>      41    xs at _FillValue = inttoshort( -9999 )     ; visually look at file/data
>      42    xs at long_name  = xs at hdf_name
>      43   ;printVarSummary(xs)
>      44   ;printMinMax(xs, True)
> 
> 
> Now when I run this                     
> I get following error
> bash-3.2$ ncl hdf4sds_6.ncl
>  Copyright (C) 1995-2007 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 5.0.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> (0)
> (0)     min=-39.1053   max=39.0529
> (0)
> (0)     min=-179.999   max=180
> fatal:Either file (f) isn't defined or variable (latentHeat) is not a variable in the file
> fatal:Execute: Error occurred at or near line 40 in file hdf4sds_6.ncl
>  
> bash-3.2$
> 
> I am beginner to NCL. Started a week before as I have to plot the Hydrometeor profile. Kindly guide further.                                                                                                 
> 
>  
> Geeta.
> 
> 
> On Tuesday, 2 September 2014 4:28 PM, Geeta Geeta <geetag54 at yahoo.com> wrote:
> 
> 
> Thanks.
> I corrected my mistake and this is how the NCL file looks like now.
> ;Reading HDF4-SDS files
> ;*********** Load Libraries ************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ;**************************************************************
> begin
> ;***************************************************************
> ; User Input
> ;***************************************************************
>                                              ; INPUT
>    diri    = "./"                            ; input directory
>    fili    = "2A12.20100702.71931.7.HDF"       ;       file
>    var     = "latentHeat"                    ; desired variable
>                                                                                                    
>                                              ; OUTPUT
>    PLOT    = True                            ; create a plot [?]
>    pltDir  = "./"                            ; directory for plot output
>   ;pltName = "2A12.100702.71931.6"           ; plot name
>    pltName = "hdf4sds"                       ; plot name
>    pltType = "ps"                            ; ps, pdf, x11, png [5.2.0]                                                                                                    
> ;***************************************************************
> ; End User Input
> ;***************************************************************
> ; Read hdf
> ;***************************************************************
>                                                                                                    
> "hdf4sds_6.ncl" 188 lines, 6725 charac
>  
> I run NCL but got following message.
> bash-3.2$ ncl hdf4sds_6.ncl
>  Copyright (C) 1995-2007 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 5.0.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> fatal:Either file (f) isn't defined or variable (geolocation) is not a variable in the file
> fatal:Execute: Error occurred at or near line 31 in file hdf4sds_6.ncl
>  
> bash-3.2$
> 
> 
> I am attaching the ncl file for reference.
> 
> This is the header information that I extracted using
> bash-3.2$ ncl_filedump 2A12.20100702.71931.7.HDF >header2010
> 
> I am attaching the header2010 as well. there is NO geolocation Variable in that. So what I should DO.
> 
> Geeta.
> 
> 
> On Tuesday, 2 September 2014 3:57 PM, Alessandra Giannini <alesall at iri.columbia.edu> wrote:
> 
> 
> 
> Hi Geeta, 
> 
> NCL is telling you what may be wrong…
> 
> Either your filename is slightly off: 
> 
> in your script you call a file by the name "2A12.20100702.71931.6.HDF", but when you list, you have a file with a 7 at the end, instead of a 6: "2A12.20100702.71931.7.HDF"
> 
> Or there is no variable called "geolocation" in the file you are reading from.
> 
> What are latitude and longitude called in the file?
> 
> best, alessandra
> 
> 
> 
> 
> 
> -- 
> Alessandra Giannini
> IRI for Climate and Society - The Earth Institute at Columbia University
> P.O. Box 1000, Palisades NY 10964-8000
> phone/fax: +1 845 680-4473/4864 - email: alesall at iri.columbia.edu
> 
> On Sep 2, 2014, at 6:21 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:
> 
> > Hi .
> > I am trying to plot the data in HDF format using NCL.
> > 
> > I happen to see the ready script available https://www.ncl.ucar.edu/Applications/Scripts/hdf4sds_6.nclwhich reads HDF data.
> > 
> > On my system I downloaded this script and tried to run this but when I run this, following message comes.
> > bash-3.2$ ncl hdf4sds_6.ncl
> >  Copyright (C) 1995-2007 - All Rights Reserved
> >  University Corporation for Atmospheric Research
> >  NCAR Command Language Version 5.0.0
> >  The use of this software is governed by a License Agreement.
> >  See http://www.ncl.ucar.edu/for more details.
> > fatal:_NclCreateFile: Requested file does not exist as (./2A12.20100702.71931.6.HDF) or as (./2A12.20100702.71931.6), can't add file
> > fatal:Either file (f) isn't defined or variable (geolocation) is not a variable in the file
> > fatal:Execute: Error occurred at or near line 31 in file hdf4sds_6.ncl
> >  
> > bash-3.2$ ls -l *HDF*
> > -rw-r--r--    1 model    staff      55092053 Sep 01 15:54 2A12.20100702.71931.7.HDF
> > -rw-r--r--    1 model    staff      55092079 Aug 12 11:13 2A12.20130523.88390.7.HDF
> > -rw-r--r--    1 model    staff      55092085 Aug 12 15:27 2A12.20140602.94247.7.HDF
> > bash-3.2$ ls -l *hdf*ncl*
> > -rw-r--r--    1 model    staff          6725 Sep 01 17:01 hdf4sds_6.ncl
> > bash-3.2$
> > 
> > The files exist in my directory.
> > Can somebody tell me what's mistake???
> > Geeta.
> > 
> >  
> > 
> > 
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> 
> 
> 
> 



More information about the ncl-talk mailing list