[ncl-talk] Data conversion

Adam Phillips asphilli at ucar.edu
Fri Feb 5 08:57:18 MST 2016


I'll second the call that you should upgrade to the newest version of ncl
(v6.3.0). I think your current error is occurring due to you loading
shea_util before contributed. Try loading the files in this order:
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

If that doesn't work let ncl-talk know..
Adam

On Fri, Feb 5, 2016 at 8:21 AM, HAVENER, KEVIN F GS-12 USAF ACC 14 WS/WXED <
kevin.havener at us.af.mil> wrote:

> Which version of ncl are you running?
>
> Kevin Havener
>
> -----Original Message-----
> From: Benjamin Alabi [mailto:alabibenjamin2 at gmail.com]
> Sent: Friday, February 05, 2016 10:09 AM
> To: HAVENER, KEVIN F GS-12 USAF ACC 14 WS/WXED
> Cc: alesall; ncl-talk at ucar.edu
> Subject: Re: [ncl-talk] Data conversion
>
> Thanks alot for your assistance.
>
>
> I added the following before ' Begin' as you have instructed me 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/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
>
> After running it, it's generated the following error:
>
>
> fatal:syntax error: line 3232 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before or near \n
>   copy_VarCoords(x, advect)
> ---------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:Syntax Error in
> block, block not executed fatal:error at line 3255 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl
>
> fatal:syntax error: line 3364 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before or near \n
>   copy_VarCoords(X, Xdp)
> ------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:Syntax Error in
> block, block not executed fatal:error at line 3400 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl
>
> fatal:syntax error: line 3478 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before or near \n
>   copy_VarCoords(t, theta)
> --------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:Syntax Error in
> block, block not executed fatal:error at line 3482 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl
>
> fatal:syntax error: line 3573 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before or near \n
>   copy_VarCoords(t,s)
> ---------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:Syntax Error in
> block, block not executed fatal:error at line 3576 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl
>
> fatal:syntax error: line 3666 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before or near \n
>   copy_VarCoords(t, theta)
> --------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:syntax error:
> line 3706 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before
> or near \n
>   copy_VarCoords(t,pv)
> ----------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:Syntax Error in
> block, block not executed fatal:error at line 3709 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl
>
> fatal:syntax error: line 3802 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before or near \n
>   copy_VarCoords(t, theta)
> --------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:syntax error:
> line 3813 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before
> or near \n
>   copy_VarCoords(t,s)
> ---------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:syntax error:
> line 3852 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before
> or near \n
>   copy_VarCoords(t,pv)
> ----------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:Syntax Error in
> block, block not executed fatal:error at line 3855 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl
>
> fatal:syntax error: line 4205 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before or near \n
>       copy_VarCoords(runs(0,:,:), maxrun)
> -----------------------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:Syntax Error in
> block, block not executed fatal:error at line 4210 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl
>
> fatal:syntax error: line 4254 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before or near \n
>   copy_VarCoords(t, dthdz)
> --------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:syntax error:
> line 4261 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before
> or near \n
>   copy_VarCoords(u, brunt)
> --------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:syntax error:
> line 4267 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before
> or near \n
>   copy_VarCoords(u, dudz)
> -------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:syntax error:
> line 4273 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before
> or near \n
>   copy_VarCoords(v, dvdz)
> -------------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:syntax error:
> line 4279 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl before
> or near \n
>   copy_VarCoords(u, Ri)
> -----------------------^
>
> fatal:syntax error: possibly an undefined procedure fatal:Syntax Error in
> block, block not executed fatal:error at line 4284 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl
>
> fatal:ContourPlotDraw: Workspace reallocation would exceed maximum size
> 100000000
> fatal:ContourPlotDraw: draw error
> warning:WorkstationDeactivate: workstation not active or not opened
>
>
> On Fri, Feb 5, 2016 at 3:15 PM, HAVENER, KEVIN F GS-12 USAF ACC 14 WS/WXED
> <kevin.havener at us.af.mil> wrote:
>
>
>         And you don't want to try to add 75.0 to the fill value in the
> script.
>
>         Kevin Havener
>
>         -----Original Message-----
>         From: ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu]
> On Behalf Of alesall
>         Sent: Friday, February 05, 2016 9:03 AM
>         To: Benjamin Alabi
>         Cc: ncl-talk at ucar.edu
>         Subject: Re: [ncl-talk] Data conversion
>
>
>         the error message is:
>
>         fatal:Undefined identifier: (byte2flt) is undefined, can't continue
>
>         it is not finding the function “byte2flt"
>         on the documentation page, this one: <
> http://ncl.ucar.edu/Document/Functions/Contributed/byte2flt.shtml>
>         it says that such function is in the “contributed” file.
>
>         you need to add statements such as:
>         load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl <
> http://ncl.ucar.edu/Document/Functions/Contributed/contrib.shtml> "
>
>         at the beginning of your script, actually before the “begin”
>
>         I have all of these in my scripts:
>
>         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/shea_util.ncl"
>         load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
>         hope this helps!
>
>
>
>         --
>         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 Feb 5, 2016, at 8:57 AM, Benjamin Alabi <
> alabibenjamin2 at gmail.com> wrote:
>
>                 Goodday sir,
>
>                 I appreciate your effort in guiding me. I'm new in this
> platform, please dont be offended by sending the message three times, I'm
> just learning to get help from here.
>
>                 I used the script,
>                 begin
>                 file_name_read = "merg_2012090101_4km-pixel"
>
>                 ir_u = byte2flt( fbindirread (file_name_read ,0,
> (/2,3298,9896/),"ubyte")) +75.0
>
>
>                 lon_g = fspan(0.0182,360,9896)
>                 lat_g = fspan(59.982,59.982-0.036383683*3298,3298)
>
>                 lon_g at units      = "degrees_east"
>                 lon_g at long_name  = "longitude"
>                 lon_g at short_name = "longitude"
>                 lon_g!0 = "lon"
>                 lon_g&lon = lon_g
>
>                 lat_g at units      = "degrees_north"
>                 lat_g at long_name  = "latitude"
>                 lat_g at short_name = "latitude"
>                 lat_g!0 = "lat"
>                 lat_g&lat = lat_g
>
>
>                 ir_u!0      = "time"
>                 ir_u!1      = "lat"
>                 ir_u!2      = "lon"
>
>                 ir_u&lat    = lat_g
>                 ir_u&lon    = lon_g
>
>                 ir_u at _FillValue= 255+75.0
>
>
>                 wks = gsn_open_wks("X11","")
>                 res = True
>                 res at cnFillOn = True
>                 res at cnFillMode = "RasterFill"
>                 res at cnLinesOn = False
>                 plot = gsn_csm_contour_map(wks, ir_u(0,:,:), res)
>
>                 ncout = addfile(file_name_read+".nc","c")
>                 ncout->ir_data = ir_u
>
>                 end
>
>
>                 But it was generating this error:
>                 fatal:Undefined identifier: (byte2flt) is undefined, can't
> continue
>                 fatal:["Execute.c":7741]:Execute: Error occurred at or
> near line 41
>
>
>                 Waiting for guide, Thanks.
>
>
>
>                 On Thu, Feb 4, 2016 at 8:07 PM, Alan Brammer <
> abrammer at albany.edu> wrote:
>
>
>                         Forgot the offset, which is mentioned in the link
> Kevin sent.
>
>
>                         ir_u = byte2flt( fbindirread (file_name_read ,0,
> (/2,3298,9896/),"ubyte")) +75.
>                         ir_u at _FillValue= 255+75.
>
>                         "Each record is a 9896 x 3298 Fortran array of IR
> brightness temperatures that have been scaled to fit into 1-byte by
> subtracting "75" from each datum. Therefore it is necessary for the user to
> add a value of "75" to each data value when using the data."
>
>
>
>                                 On 4 Feb 2016, at 13:30, Alan Brammer <
> abrammer at albany.edu> wrote:
>
>                                 ok, wow. Don’t send the same message 3
> times, if the first answers weren’t complete at least expand and attempt
> something not just copy paste the same lines again.
>
>                                 as said before .Z means it’s compressed.
> gunzip merg_2016020123_4km-pixel.Z  will uncompress it. Then you have a
> binary file as a small amount of googling would have told you.
>                                 The same search would have linked you to
> various messages on here and various scripts where other people have
> included simple examples of this file type (myself included). Here is an
> example of reading and making a simple plot.  There are plenty of examples
> on how to write netcdf on the NCL website so you should develop code from
> there.  Most simple example at bottom of script below.
>
> https://www.ncl.ucar.edu/Applications/o-netcdf.shtml
>
>                                 Read the documentation on the below
> functions and understand what is occurring .
>
>
>                                 begin
>                                 file_name_read = "merg_2016020123
> _4km-pixel"
>
>                                 ir_u = byte2flt( fbindirread
> (file_name_read ,0, (/2,3298,9896/),"ubyte"))
>
>
>                                 lon_g = fspan(0.0182,360,9896)
>                                 lat_g =
> fspan(59.982,59.982-0.036383683*3298,3298)
>
>                                 lon_g at units      = "degrees_east"
>                                 lon_g at long_name  = "longitude"
>                                 lon_g at short_name = "longitude"
>                                 lon_g!0 = "lon"
>                                 lon_g&lon = lon_g
>
>                                 lat_g at units      = "degrees_north"
>                                 lat_g at long_name  = "latitude"
>                                 lat_g at short_name = "latitude"
>                                 lat_g!0 = "lat"
>                                 lat_g&lat = lat_g
>
>
>                                 ir_u!0      = "time"
>                                 ir_u!1      = "lat"
>                                 ir_u!2      = "lon"
>
>                                 ir_u&lat    = lat_g
>                                 ir_u&lon    = lon_g
>
>                                 ir_u at _FillValue= 255
>
>
>                                 wks = gsn_open_wks("X11","")
>                                 res = True
>                                 res at cnFillOn = True
>                                 res at cnFillMode = "RasterFill"
>                                 res at cnLinesOn = False
>                                 plot = gsn_csm_contour_map(wks,
> ir_u(0,:,:), res)
>
>                                 ncout = addfile(file_name_read+”.nc”,”c”)
>                                 ncout->ir_data = ir_u
>
>                                 end
>
>
>
>
>
>
>                                         On 4 Feb 2016, at 13:04, Benjamin
> Alabi <alabibenjamin2 at gmail.com> wrote:
>
>                                         Thanks for your assistance sir.
> I've tried the cdo to get general information on the data, but it didn't
> work
>                                         I need help from someone that can
> guide me to convert this data format - 'merg_2012091000_4km-pixel.Z' to
> netcdf format.
>                                         I download Gobally-merged
> (60N-60S) pixel-resolution IR brightness temperature data (equivalent
> blackbody temps), merged from all available geostationary satellites
> (GOES-8/10, METEOSAT-7/5)
>                                         This is the link:
>
> http://mirador.gsfc.nasa.gov/cgi-bin/mirador/presentNavigation.pl?tree=project&dataset=Global-merged%20IR%20Brightness%20Temperature%20Data&project=TRMM&dataGroup=Ancillary&version=001&CGISESSID=25c6337b80163b3743e8bea85d015558
> .
>
>                                         I really want it to be in netcdf
> format.
>
>
>                                         Regard
>
>
>
>
>
> _______________________________________________
>                                         ncl-talk mailing list
>                                         ncl-talk at ucar.edu
>                                         List instructions, subscriber
> options, unsubscribe:
>
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
>
>                 _______________________________________________
>                 ncl-talk mailing list
>                 ncl-talk at ucar.edu
>                 List instructions, subscriber options, unsubscribe:
>                 http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>



-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160205/75d4a323/attachment.html 


More information about the ncl-talk mailing list