[ncl-talk] Data conversion

Alan Brammer abrammer at albany.edu
Tue Feb 9 05:47:00 MST 2016


The script looks fine for converting a single file.
Does it work and does the data look right? That's usually the best/easiest
way to see.
On 9 Feb 2016 7:35 a.m., "Benjamin Alabi" <alabibenjamin2 at gmail.com> wrote:

> Re: Data conversion
>
> I want to use this medium to thank the forum and everyone that respond to
> my challenge in converting from binary data to netcdf. May you find help in
> time of need IJN, Amen.
> I have finally gotten the solution by commenting the image part of the
> script and gave me the netcdf form of the data.
> Concern the addition of 75.0, I will like my helper to look unto the
> script finally used if it has been implemented or not for correction sir.
>
> ; A script to convert binary data to netcdf
> 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"
>
> begin
> file_name_read = "merg_2012090200_4km-pixel"
>
> ir_u = byte2flt( fbindirread (file_name_read ,0, (/2,3298,9896/),"ubyte"))
> + 75.
>
>
> 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.
>
>
> ;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
>
> Waiting for your comment.
>
> On Mon, Feb 8, 2016 at 8:00 PM, <ncl-talk-request at ucar.edu> wrote:
>
>> Send ncl-talk mailing list submissions to
>>         ncl-talk at ucar.edu
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> or, via email, send a message with subject or body 'help' to
>>         ncl-talk-request at ucar.edu
>>
>> You can reach the person managing the list at
>>         ncl-talk-owner at ucar.edu
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of ncl-talk digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Re: gsn_csm_vector_scalar_map (Mary Haley)
>>    2. Re: ncl-talk Digest, Vol 147, Issue 8 (Benjamin Alabi)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Sun, 7 Feb 2016 16:02:07 -0700
>> From: Mary Haley <haley at ucar.edu>
>> Subject: Re: [ncl-talk] gsn_csm_vector_scalar_map
>> To: Xi Chang <xi.chang01 at gmail.com>
>> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> Message-ID:
>>         <CACNN_CJ0hGL=_
>> n28qjNZza2AP+BemRwK-sRFFgThi+rcXVVwUw at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Xi,
>>
>> For an example of using gsn_csm_vector_scalar_map and changing the contour
>> levels, please see example "lcnative_5.ncl" at:
>>
>> http://www.ncl.ucar.edu/Applications/lcnative.shtml#ex5
>>
>> You will need to add the following lines to the code:
>>
>>   res at cnLevelSelectionMode    = "ManualLevels"
>>   res at cnMinLevelValF          = 270
>>   res at cnMaxLevelValF          = 310
>>   res at cnLevelSpacingF         = 2
>>
>> The data file can be downloaded from:
>>
>> http://www.ncl.ucar.edu/Applications/Data/#grb
>>
>> Note that this example also shows how to create this kind of plot using
>> gsn_csm_contour_map and gsn_csm_vector.  I sometimes recommend this method
>> if you want more control over the individual vector and contour plots.
>>
>> --Mary
>>
>>
>> On Fri, Feb 5, 2016 at 1:19 PM, Xi Chang <xi.chang01 at gmail.com> wrote:
>>
>> > Hi Karin,,
>> >
>> > I did, but it doesnt work for gsn_csm_vector_scalar_map, no idea why..
>> >
>> > Chang.
>> >
>> > On Fri, Feb 5, 2016 at 7:53 PM, Karin Meier-Fleischer <
>> > meier-fleischer at dkrz.de> wrote:
>> >
>> >> Hi Xi,
>> >>
>> >> have you taken a look at the first example of the vector examples page
>> >>     http://ncl.ucar.edu/Applications/Scripts/vector_1.ncl
>> >>
>> >> When you want to control the minimum/maximum and interval of the
>> contour
>> >> lines use
>> >>
>> >>   res at cnLevelSelectionMode = "ManualLevels"     ; set manual contour
>> levels
>> >>   res at cnMinLevelValF       = 24.0               ; set min contour
>> level
>> >>   res at cnMaxLevelValF       = 29                 ; set max contour
>> level
>> >>   res at cnLevelSpacingF      = 0.10               ; set contour spacing
>> >>
>> >> Bye,
>> >> Karin
>> >>
>> >> Am 05.02.16 um 19:00 schrieb Xi Chang:
>> >>
>> >> Hello...
>> >>
>> >> Could you please tell me how to control the contour interval for color
>> >> shading once im using this function  *gsn_csm_vector_scalar_map*.
>> >>
>> >> ;===========PLOT=================
>> >>
>> >>   wks = gsn_open_wks("png","overlay")
>> >>
>> >>   res                       = True              ; plot mods desired
>> >>   plot = new(16,graphic)
>> >>
>> >>   res at gsnDraw             = False           ; don't draw
>> >>   res at gsnFrame            = False           ; don't advance frame
>> >>
>> >> ; vector rescoures
>> >>   res at vcRefLengthF             = 0.045
>> >>   res at vcRefMagnitudeF          = 20.0
>> >>   res at vcRefAnnoOrthogonalPosF  = -0.12
>> >>   res at vcRefAnnoParallelPosF    =  0.997
>> >>   res at vcRefAnnoFontHeightF     = 0.015
>> >>   res at vcMinDistanceF          = 0.03
>> >>   res at lbLabelBarOn        = False
>> >>
>> >>   res at mpProjection   = "AzimuthalEquidistant"  ; choose map projection
>> >>   res at mpLimitMode    = "LatLon"          ; use lat/lon coordinates to
>> >> limit area
>> >>   res at mpMinLatF      = 25.
>> >>   res at mpMaxLatF      = 75.
>> >>   res at mpMinLonF      = -80.
>> >>   res at mpMaxLonF      = 20.
>> >>   res at gsnMaximize           = True
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> *  res at gsnScalarContour        = True   res at cnFillOn                =
>> >> True   res at cnFillPalette           = "gui_default"     ; set color map
>> >> res at cnLinesOn               = False             ; turn off contour
>> lines *
>> >>
>> >>
>> >>   do i=0,15
>> >>   plot(i)  = gsn_csm_vector_scalar_map(wks,u(i,:,:),v(i,:,:), \
>> >>                                    p(i,:,:),res)
>> >>   end do
>> >>
>> >>   resP                     = True                ; modify the panel
>> plot
>> >>   resP at gsnMaximize           = True
>> >>   gsn_panel(wks,plot,(/4,4/),resP)               ; now draw as one plot
>> >>
>> >>
>> >> end
>> >>
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> ncl-talk mailing listncl-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
>> >
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160207/91dbc6ee/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Mon, 8 Feb 2016 12:03:22 +0100
>> From: Benjamin Alabi <alabibenjamin2 at gmail.com>
>> Subject: Re: [ncl-talk] ncl-talk Digest, Vol 147, Issue 8
>> To: ncl-talk at ucar.edu
>> Message-ID:
>>         <
>> CADnXx_-kQj0SSFRctExs4WEQwy8f7ZunpFo4sktGwiNkYzt2WQ at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Goodday sir
>> I think i've added 75 to ' ir_u at _FillValue= 255 '.  pls check this script
>> for any correction:
>>
>> ; A script to convert binary data to netcdf
>> 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"
>>
>> begin
>> file_name_read = "merg_2012090102_4km-pixel"
>>
>> ir_u = byte2flt( fbindirread (file_name_read ,0, (/2,3298,9896/),"ubyte"))
>> + 75.
>>
>>
>> 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.
>>
>>
>> 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 Sat, Feb 6, 2016 at 8:00 PM, <ncl-talk-request at ucar.edu> wrote:
>>
>> > Send ncl-talk mailing list submissions to
>> >         ncl-talk at ucar.edu
>> >
>> > To subscribe or unsubscribe via the World Wide Web, visit
>> >         http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> > or, via email, send a message with subject or body 'help' to
>> >         ncl-talk-request at ucar.edu
>> >
>> > You can reach the person managing the list at
>> >         ncl-talk-owner at ucar.edu
>> >
>> > When replying, please edit your Subject line so it is more specific
>> > than "Re: Contents of ncl-talk digest..."
>> >
>> >
>> > Today's Topics:
>> >
>> >    1. Re: Data conversion (Alan Brammer)
>> >    2. Re: gsn_csm_vector_scalar_map (Xi Chang)
>> >    3. Re: gsn_csm_vector_scalar_map (alesall)
>> >    4. Re: read and write netcdf-4 compressed files (David Brown)
>> >
>> >
>> > ----------------------------------------------------------------------
>> >
>> > Message: 1
>> > Date: Fri, 5 Feb 2016 14:10:24 -0500
>> > From: Alan Brammer <abrammer at albany.edu>
>> > Subject: Re: [ncl-talk] Data conversion
>> > To: Benjamin Alabi <alabibenjamin2 at gmail.com>
>> > Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> > Message-ID: <564569E1-65BD-4130-B4EA-872812D72277 at albany.edu>
>> > Content-Type: text/plain; charset="utf-8"
>> >
>> > > And you don't want to try to add 75.0 to the fill value in the script.
>> >
>> > Just to respond to this and clarify, the missing value in the
>> > documentation that was linked to is 330. (
>> > http://www.cpc.ncep.noaa.gov/products/global_precip/html/README <
>> > http://www.cpc.ncep.noaa.gov/products/global_precip/html/README> )
>> >
>> > When I put the example script together I first posted, I just saw what
>> was
>> > obviously a missing value at 255, having forgotten the offset.   255 is
>> a
>> > very reasonable value in the world of brightness temps, so apologies for
>> > that,  in my haste I made a mistake there in the first script.
>> >
>> > So the real _FillValue should be 330 (i.e. 255+75 )
>> >
>> >
>> >
>> >
>> > > On 5 Feb 2016, at 09:15, 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
>> >
>> > -------------- next part --------------
>> > An HTML attachment was scrubbed...
>> > URL:
>> >
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160205/2fdc6d64/attachment-0001.html
>> >
>> > ------------------------------
>> >
>> > Message: 2
>> > Date: Fri, 5 Feb 2016 21:19:10 +0100
>> > From: Xi Chang <xi.chang01 at gmail.com>
>> > Subject: Re: [ncl-talk] gsn_csm_vector_scalar_map
>> > To: Karin Meier-Fleischer <meier-fleischer at dkrz.de>
>> > Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> > Message-ID:
>> >         <CAGfRhteOJRK4=Rvrnoua8a+JDA2HQwfe8Q2jMhN=
>> > cmtmrj7gVg at mail.gmail.com>
>> > Content-Type: text/plain; charset="utf-8"
>> >
>> > Hi Karin,,
>> >
>> > I did, but it doesnt work for gsn_csm_vector_scalar_map, no idea why..
>> >
>> > Chang.
>> >
>> > On Fri, Feb 5, 2016 at 7:53 PM, Karin Meier-Fleischer <
>> > meier-fleischer at dkrz.de> wrote:
>> >
>> > > Hi Xi,
>> > >
>> > > have you taken a look at the first example of the vector examples page
>> > >     http://ncl.ucar.edu/Applications/Scripts/vector_1.ncl
>> > >
>> > > When you want to control the minimum/maximum and interval of the
>> contour
>> > > lines use
>> > >
>> > >   res at cnLevelSelectionMode = "ManualLevels"     ; set manual contour
>> > levels
>> > >   res at cnMinLevelValF       = 24.0               ; set min contour
>> level
>> > >   res at cnMaxLevelValF       = 29                 ; set max contour
>> level
>> > >   res at cnLevelSpacingF      = 0.10               ; set contour spacing
>> > >
>> > > Bye,
>> > > Karin
>> > >
>> > > Am 05.02.16 um 19:00 schrieb Xi Chang:
>> > >
>> > > Hello...
>> > >
>> > > Could you please tell me how to control the contour interval for color
>> > > shading once im using this function  *gsn_csm_vector_scalar_map*.
>> > >
>> > > ;===========PLOT=================
>> > >
>> > >   wks = gsn_open_wks("png","overlay")
>> > >
>> > >   res                       = True              ; plot mods desired
>> > >   plot = new(16,graphic)
>> > >
>> > >   res at gsnDraw             = False           ; don't draw
>> > >   res at gsnFrame            = False           ; don't advance frame
>> > >
>> > > ; vector rescoures
>> > >   res at vcRefLengthF             = 0.045
>> > >   res at vcRefMagnitudeF          = 20.0
>> > >   res at vcRefAnnoOrthogonalPosF  = -0.12
>> > >   res at vcRefAnnoParallelPosF    =  0.997
>> > >   res at vcRefAnnoFontHeightF     = 0.015
>> > >   res at vcMinDistanceF          = 0.03
>> > >   res at lbLabelBarOn        = False
>> > >
>> > >   res at mpProjection   = "AzimuthalEquidistant"  ; choose map
>> projection
>> > >   res at mpLimitMode    = "LatLon"          ; use lat/lon coordinates to
>> > > limit area
>> > >   res at mpMinLatF      = 25.
>> > >   res at mpMaxLatF      = 75.
>> > >   res at mpMinLonF      = -80.
>> > >   res at mpMaxLonF      = 20.
>> > >   res at gsnMaximize           = True
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > *  res at gsnScalarContour        = True   res at cnFillOn                =
>> > True
>> > >   res at cnFillPalette           = "gui_default"     ; set color map
>> > > res at cnLinesOn               = False             ; turn off contour
>> > lines *
>> > >
>> > >
>> > >   do i=0,15
>> > >   plot(i)  = gsn_csm_vector_scalar_map(wks,u(i,:,:),v(i,:,:), \
>> > >                                    p(i,:,:),res)
>> > >   end do
>> > >
>> > >   resP                     = True                ; modify the panel
>> plot
>> > >   resP at gsnMaximize           = True
>> > >   gsn_panel(wks,plot,(/4,4/),resP)               ; now draw as one
>> plot
>> > >
>> > >
>> > > end
>> > >
>> > >
>> > >
>> > >
>> > > _______________________________________________
>> > > ncl-talk mailing listncl-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
>> > >
>> > >
>> > -------------- next part --------------
>> > An HTML attachment was scrubbed...
>> > URL:
>> >
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160205/4e881daa/attachment-0001.html
>> >
>> > ------------------------------
>> >
>> > Message: 3
>> > Date: Fri, 5 Feb 2016 15:21:44 -0500
>> > From: alesall <alesall at iri.columbia.edu>
>> > Subject: Re: [ncl-talk] gsn_csm_vector_scalar_map
>> > To: Xi Chang <xi.chang01 at gmail.com>
>> > Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> > Message-ID: <257ABA37-BFD7-49C5-B6CB-193B6F81F39F at iri.columbia.edu>
>> > Content-Type: text/plain; charset="us-ascii"
>> >
>> > Hi, is it complaining that the spacing is too fine compared to the wide
>> > range between min and max values, and reverting to doing what it thinks
>> > best?
>> >
>> >
>> >
>> > --
>> > 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
>> <mailto:
>> > alesall at iri.columbia.edu>
>> > > On Feb 5, 2016, at 3:19 PM, Xi Chang <xi.chang01 at gmail.com> wrote:
>> > >
>> > > Hi Karin,,
>> > >
>> > > I did, but it doesnt work for gsn_csm_vector_scalar_map, no idea why..
>> > >
>> > > Chang.
>> > >
>> > > On Fri, Feb 5, 2016 at 7:53 PM, Karin Meier-Fleischer <
>> > meier-fleischer at dkrz.de <mailto:meier-fleischer at dkrz.de>> wrote:
>> > > Hi Xi,
>> > >
>> > > have you taken a look at the first example of the vector examples page
>> > >     http://ncl.ucar.edu/Applications/Scripts/vector_1.ncl <
>> > http://ncl.ucar.edu/Applications/Scripts/vector_1.ncl>
>> > >
>> > > When you want to control the minimum/maximum and interval of the
>> contour
>> > lines use
>> > >   res at cnLevelSelectionMode = "ManualLevels"     ; set manual contour
>> > levels
>> > >   res at cnMinLevelValF       = 24.0               ; set min contour
>> level
>> > >   res at cnMaxLevelValF       = 29                 ; set max contour
>> level
>> > >   res at cnLevelSpacingF      = 0.10               ; set contour spacing
>> > > Bye,
>> > > Karin
>> > >
>> > > Am 05.02.16 um 19:00 schrieb Xi Chang:
>> > >> Hello...
>> > >>
>> > >> Could you please tell me how to control the contour interval for
>> color
>> > shading once im using this function  gsn_csm_vector_scalar_map.
>> > >>
>> > >> ;===========PLOT=================
>> > >>
>> > >>   wks = gsn_open_wks("png","overlay")
>> > >>
>> > >>   res                       = True              ; plot mods desired
>> > >>   plot = new(16,graphic)
>> > >>
>> > >>   res at gsnDraw             = False           ; don't draw
>> > >>   res at gsnFrame            = False           ; don't advance frame
>> > >>
>> > >> ; vector rescoures
>> > >>   res at vcRefLengthF             = 0.045
>> > >>   res at vcRefMagnitudeF          = 20.0
>> > >>   res at vcRefAnnoOrthogonalPosF  = -0.12
>> > >>   res at vcRefAnnoParallelPosF    =  0.997
>> > >>   res at vcRefAnnoFontHeightF     = 0.015
>> > >>   res at vcMinDistanceF          = 0.03
>> > >>   res at lbLabelBarOn        = False
>> > >>
>> > >>   res at mpProjection   = "AzimuthalEquidistant"  ; choose map
>> projection
>> > >>   res at mpLimitMode    = "LatLon"          ; use lat/lon coordinates
>> to
>> > limit area
>> > >>   res at mpMinLatF      = 25.
>> > >>   res at mpMaxLatF      = 75.
>> > >>   res at mpMinLonF      = -80.
>> > >>   res at mpMaxLonF      = 20.
>> > >>   res at gsnMaximize           = True
>> > >>
>> > >>   res at gsnScalarContour        = True
>> > >>   res at cnFillOn                = True
>> > >>   res at cnFillPalette           = "gui_default"     ; set color map
>> > >>   res at cnLinesOn               = False             ; turn off contour
>> > lines
>> > >>
>> > >>
>> > >>
>> > >>   do i=0,15
>> > >>   plot(i)  = gsn_csm_vector_scalar_map(wks,u(i,:,:),v(i,:,:), \
>> > >>                                    p(i,:,:),res)
>> > >>   end do
>> > >>
>> > >>   resP                     = True                ; modify the panel
>> plot
>> > >>   resP at gsnMaximize           = True
>> > >>   gsn_panel(wks,plot,(/4,4/),resP)               ; now draw as one
>> plot
>> > >>
>> > >>
>> > >> end
>> > >>
>> > >>
>> > >>
>> > >>
>> > >> _______________________________________________
>> > >> ncl-talk mailing list
>> > >> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> > >> List instructions, subscriber options, unsubscribe:
>> > >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>> > >
>> > >
>> > > _______________________________________________
>> > > ncl-talk mailing list
>> > > ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> > > List instructions, subscriber options, unsubscribe:
>> > > http://mailman.ucar.edu/mailman/listinfo/ncl-talk <
>> > 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
>> >
>> > -------------- next part --------------
>> > An HTML attachment was scrubbed...
>> > URL:
>> >
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160205/8c35e975/attachment-0001.html
>> >
>> > ------------------------------
>> >
>> > Message: 4
>> > Date: Fri, 5 Feb 2016 14:37:26 -0700
>> > From: David Brown <dbrown at ucar.edu>
>> > Subject: Re: [ncl-talk] read and write netcdf-4 compressed files
>> > To: Dan Chen <dchen at ucar.edu>, ncl-talk <ncl-talk at ucar.edu>
>> > Message-ID:
>> >         <
>> > CAC92F7fDd6iTx4N401jbbN-G6ieUzzgFEuW5TG9QhMHLaRvx3A at mail.gmail.com>
>> > Content-Type: text/plain; charset=UTF-8
>> >
>> > Hi Dan,
>> > The problem is a dimension mismatch. I am not sure why it does not get
>> > reported as such, but here is the issue:
>> > Your call to wrf_user_getvar asks for time step 0, granted the only
>> > time step since the Time dimension has only 1 element. But the result
>> > is that the return variable 'bb' is reduced from 4 dimensions (t,
>> > z,y,x) in the file variable to 3 (z,y,x) in the local variable.
>> >
>> > Then you are trying to assign this 3d variable to a 4d variable in the
>> > file. This causes the error.
>> > There are two ways to fix it.
>> > 1) Substitute -1 for 0 in the 3rd argument to wrf_user_getvar. You
>> > will then get Time as the leftmost dimension of a 4d variable, and the
>> > write can proceed without error.
>> > 2) Or leave the wrf_user_getvar call alone. You can write the 3d local
>> > variable into the 4d file variable by subscripting the left hand side
>> > of the assignment:
>> >
>> > in->PM2_5_DRY(0,:,:,:) = (/bb/)
>> >
>> > We will look into why this is not caught earlier with a more apropos
>> > "dimension mismatch" error to avoid the trip into the NetCDF library
>> > code and the resulting low-level error messages.
>> >  -dave
>> >
>> >
>> > On Thu, Feb 4, 2016 at 8:16 PM, Dan Chen <dchen at ucar.edu> wrote:
>> > > Hi,
>> > >
>> > > My name is Dan Chen working at MMM, NCAR.  I'm using ncl to read a
>> > variable
>> > > and write into the netcdf-4 compressed file on Yellowstone, but
>> failed.
>> > >
>> > > The script is as blow:
>> > > ========================================
>> > > 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/wrf/WRFUserARW.ncl"
>> > > load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
>> > >
>> > >     begin
>> > >
>> > >      fils = "/glade/scratch/dchen/ncl_netcdf4/analysis.ensmean"
>> > >       in = addfile(fils,"w")
>> > >       bb = wrf_user_getvar(in,"PM2_5_DRY",0)
>> > >       bb = bb*10
>> > >     fils->PM2_5_DRY = (/bb/)
>> > >
>> > >     end
>> > > ==========================================
>> > >
>> > >
>> > > The error is as below
>> > > =========================
>> > >   Copyright (C) 1995-2015 - All Rights Reserved
>> > >  University Corporation for Atmospheric Research
>> > >  NCAR Command Language Version 6.3.0
>> > >  The use of this software is governed by a License Agreement.
>> > >  See http://www.ncl.ucar.edu/ for more details.
>> > > fatal:["NclNetCDF4.c":3073]:NclNetCDF4.c: Error in
>> nc_def_var_chunking in
>> > > file (/glade/scratch/dchen/ncl_netcdf4/analysis.ensmean) for writing,
>> at
>> > > line: 3073
>> > >
>> > > line 3074 of NclNetCDF4.c: NetCDF: Attempt to define var properties,
>> like
>> > > deflate, after enddef.
>> > > ============================
>> > >
>> > >
>> > > If I change the input file to a normal netcdf file without the
>> > compression
>> > > option, it works fine. But I do need to process those netcdf-4
>> compressed
>> > > files.  Can you let me know if there is anything I can try?
>> > >
>> > > Many thanks,
>> > > Dan
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > _______________________________________________
>> > > 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
>> >
>> >
>> > End of ncl-talk Digest, Vol 147, Issue 8
>> > ****************************************
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160208/95b6eae0/attachment-0001.html
>>
>> ------------------------------
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> End of ncl-talk Digest, Vol 147, Issue 10
>> *****************************************
>>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160209/ab7003ed/attachment.html 


More information about the ncl-talk mailing list