[ncl-talk] variable info on color bar

Luis del Castillo luis.delcastillo at cathalac.int
Sat Jan 7 09:22:09 MST 2017


Thank for the quick answer but
I am getting this
warning:gsnLeftString is not a valid resource in ptot1hracc.2016-12-01_07:00:00_contour at this time
warning:gsnRightString is not a valid resource in ptot1hracc.2016-12-01_07:00:00_contour at this time

here is the code:

;   Example script to produce plots for a WRF real-data run,
;   with the ARW coordinate dynamics option.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
  a = addfile("wrfout_d01_2016-12-01_06:00:00.nc","r")


; We generate plots, but what kind do we prefer?
; type = "x11"
; type = "pdf"
  type = "png"
; type = "ps"
; type = "ncgm"

; Set some basic resources
  res = True
  res at MainTitle = "WRF - 27km res - 72hr Pronostico"

  pltres = True
  mpres = True
  mpres at mpGeophysicalLineColor = "Black"
  mpres at mpGeophysicalLineThicknessF = "2.0"
  mpres at mpOutlineBoundarySets  = "National"
  mpres at mpNationalLineColor    = "Black"
  mpres at mpNationalLineThicknessF = 2.0
  mpres at mpUSStateLineColor     = "Black"
  mpres at mpGridLineColor        = "Black"
  mpres at mpLimbLineColor        = "Black"
  mpres at mpPerimLineColor       = "Black"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; What times and how many time steps are in the data set?
  FirstTime = True
  times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
  ntimes = dimsizes(times)         ; number of times in the file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

do it = 0,ntimes-1,1             ; TIME LOOP

   wks = gsn_open_wks(type,"ptot1hracc."+times(it))
   print("Working on time: " + times(it) )
   if (FirstTime) then            ; Save some times for tracking tendencies
     times_sav = times(it)
   end if
  res at TimeLabel = times(it)   ; Set Valid time to use on plots

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need

; Get non-convective, convective and total precipitation
; Calculate tendency values
   rainnc = wrf_user_getvar(a,"RAINNC",it)
   rainc = wrf_user_getvar(a,"RAINC",it)
   rain_tot = rainnc + rainc

       if( FirstTime ) then
      if ( it .eq. 0 ) then
        rainnc_save = rainnc
        rainc_save = rainc
        rain_tot_save = rain_tot
      else
        rainnc_save = wrf_user_getvar(a,"RAINNC",it-1)
        rainc_save = wrf_user_getvar(a,"RAINC",it-1)
        rain_tot_save = rainnc_save + rainc_save
        FirstTime = False
        times_sav = times(it-1)
      end if
    end if

     prep_nc = rainnc - rainnc_save
      prep_c = rainc - rainc_save
    prep_tot = rain_tot - rain_tot_save

    prep_tot at description = "Precipitacion horaria acumulada"
    prep_tot at units       = "mm"

; Bookkeeping, just to allow the tendency at the next time step
    rainnc_save = rainnc
    rainc_save = rainc
    rain_tot_save = rain_tot

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   if( .not. FirstTime ) then     ; We will skip the first time

      ; Plotting options for Precipitation
        opts_r = res
        opts_r at cnLevelSelectionMode = "ExplicitLevels"
        opts_r at cnLevels             = (/ .1, .25, .5, 1, 1.5, 2, 3, \
                                        4, 5, 7.5, 10, 12.5, 15, 20, 25, 30, 40/)
        opts_r at cnFillColors         = (/"White","Green","Green", \
                                        "Green","Green3","Chartreuse4", \
                                        "Green4","ForestGreen","darkgreen", \
                                        "Yellow","gold","Orange","coral", \
                                        "Red","deeppink3","deeppink","magenta","Violet"/)
        opts_r at cnInfoLabelOn        = False
        opts_r at cnConstFLabelOn      = False
        opts_r at cnFillOn             = True
        opts_r at Footer               = False
        opts_r at InitTime             = False
        opts_r at MainTitlePos         = "Right"
        opts_r at ValidTime            = False
        opts_r at gsnLeftString        = ""
        opts_r at gsnRightString       = ""

        contour_tend = wrf_contour(a,wks, prep_tot,opts_r) ; total (color)
        delete(opts_r)


      ; MAKE PLOTS

        ; Total Precipitation 1hr
          plot = wrf_map_overlays(a,wks,contour_tend,pltres,mpres)

     cmd = "composite -geometry 250x72+90+15 cathalaclogo.jpg ptot1hracc." + times(it) +".png ptot1hracc." + times(it) + ".png"
     system(cmd)

    end if    ; END IF FOR SKIPPING FIRST TIME

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   times_sav = times(it)
   FirstTime = False
  end do        ; END OF TIME LOOP
end


thanks for your help

Alejandro
From: Dennis Shea [mailto:shea at ucar.edu]
Sent: viernes, 6 de enero de 2017 10:44 p. m.
To: Luis del Castillo
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] variable info on color bar

By default, the 'gsn_csm_contour_map' places the variable's long_name attribute in the upper left
If the variable being plotted has the 'long_name' and/or 'units' attribute, the default behavior for 'gsn_csm_contour_map' is to place the long_name just above the plot on the left and the units attribute just above the plot on the right.
You could
[1]
     delete(var at long_name)   ; if present
     delete(var at units)             ;       "
or, set the two resources
[2]   res at gsnLeftString   = ""   ; upper left
       res at gsnRightString = ""   ; upper right

On Fri, Jan 6, 2017 at 5:07 PM, Luis del Castillo <luis.delcastillo at cathalac.int<mailto:luis.delcastillo at cathalac.int>> wrote:
Hi everyone I am trying to get my map configured as follows



[cid:image007.png at 01D268D8.20514F70]



[cid:image008.jpg at 01D268D8.20514F70]

But I don’t want to get the Var description on the top left corner. I try a couple of thinks but without no success.
I try to use :
opts at lbTitleOn = true
opts at lbTitleString = “Precipitacion horaria acumulada”

And still the same, then I delete from the script
opts at UnitLabel as result my bar label was disappear from the color bar and from the top of the image

so right now I have it like this

prep_tot at description = "Precipitacion horaria acumulada"
prep_tot at units              = "mm"

But again I just want this text description on my color bar and not on the top of the map

thanks

[Description: http://www.cathalac.org/firma/format_02a.gif]

[Description: http://www.cathalac.org/firma/logocatha.gif]<http://www.cathalac.org/>
Luis Alejandro Del Castillo Riley
Gerente de Tecnologia
DIVISIÓN DE TECNOLOGÍAS DE LA INFORMACIÓN Y COMUNICACIÓN
Tel: 507-317-3235<tel:(507)%20317-3235>
Email: luis.delcastillo at cathalac.int<mailto:luis.delcastillo at cathalac.int>
<http://www.cathalac.org/>[Description: http://www.cathalac.org/firma/facebook.png]<https://www.facebook.com/cathalac> [Description: http://www.cathalac.org/firma/twitter.png] <http://twitter.com/#!/CATHALAC>  [Description: http://www.cathalac.org/firma/linkindin.png] <http://www.linkedin.com/company/2324157>  [Description: http://www.cathalac.org/firma/youtube.png] <http://www.youtube.com/user/CATHALACTV>




_______________________________________________
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170107/c26054d1/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.png
Type: image/png
Size: 240 bytes
Desc: image007.png
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170107/c26054d1/attachment.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image008.jpg
Type: image/jpeg
Size: 29778 bytes
Desc: image008.jpg
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170107/c26054d1/attachment.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image009.png
Type: image/png
Size: 3374 bytes
Desc: image009.png
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170107/c26054d1/attachment-0001.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image010.png
Type: image/png
Size: 3990 bytes
Desc: image010.png
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170107/c26054d1/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image011.png
Type: image/png
Size: 329 bytes
Desc: image011.png
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170107/c26054d1/attachment-0003.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image012.png
Type: image/png
Size: 471 bytes
Desc: image012.png
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170107/c26054d1/attachment-0004.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image013.png
Type: image/png
Size: 357 bytes
Desc: image013.png
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170107/c26054d1/attachment-0005.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image014.png
Type: image/png
Size: 629 bytes
Desc: image014.png
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170107/c26054d1/attachment-0006.png 


More information about the ncl-talk mailing list