[ncarg-talk] HELP!!!

Mary Haley haley at ucar.edu
Tue Oct 16 11:45:58 MDT 2018


Dear Nelson,

In the future, please post NCL questions to ncl-talk. You must subscribe
first:

http://mailman.ucar.edu/mailman/listinfo/ncl-talk

The error is telling you that you have no valid values in your data, which
usually is an indication that your values are all missing.

When you have problems plotting your data, we tell people to look at their
data to make sure it is okay. You can use functions like print, printMinMax
and printVarSummary to help you with this.

You can also use the all and ismissing functions to determine if all your
values are missing:

print("Is my uAvg data all missing? " + all(ismissing(uAvg)))
print("Is my vAvg data all missing? " + all(ismissing(vAvg)))
print("Is my xAvg data all missing? " + all(ismissing(xAvg)))

I would look closely at how these three variables are being calculated and
make sure you don't have an error in your script somewhere.  For example,
since your data is being calculated with these statements:

         xAvg = dim_avg_Wrap( x(lat|:,lon|:,time|nt) )
         uAvg = dim_avg_Wrap( u(lat|:,lon|:,time|nt) )
         vAvg = dim_avg_Wrap( v(lat|:,lon|:,time|nt) )

then you need to check x, u, and v as well to make sure they have valid
values in them. I would do this on the variables as they are being
referenced, as it may be the case that your data is all missing for just
certain time steps:

         printMinMax(x(nt,:,:),0)
         printMinMax(u(nt,:,:),0)
         printMinMax(v(nt,:,:),0)

A tip: it is expensive to reorder arrays. I recommend using the
dim_avg_n_Wrap function so you don't have to reorder the array first:

         xAvg = dim_avg_n_Wrap(x(nt,:,:),0)
         uAvg = dim_avg_n_Wrap(u(nt,:,:),0)
         vAvg = dim_avg_n_Wrap(v(nt,:,:),0)

If you continue to have problems, please subscribe to ncl-talk and post the
question there.

Thanks,

--Mary




On Fri, Oct 12, 2018 at 11:50 PM, NELSON MATEUS <mateus12es at gmail.com>
wrote:

> Hi, I'm trying to plot the "mjoclivar_16 and I'm finding some errors" the
> script and the error are listed below, "could you help me please?
> ________________________________________________________________
>
> error :
>
> fatal:error in statement
> warning:VectorPlotInitialize: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
> warning:VectorPlotSetValues: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotSetValues: no valid values in scalar field; ContourPlot
> not possible:[errno=1101]
> warning:VectorPlotInitialize: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
> warning:VectorPlotSetValues: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotSetValues: no valid values in scalar field; ContourPlot
> not possible:[errno=1101]
> warning:VectorPlotInitialize: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
> warning:VectorPlotSetValues: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotSetValues: no valid values in scalar field; ContourPlot
> not possible:[errno=1101]
> warning:VectorPlotInitialize: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
> warning:VectorPlotSetValues: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotSetValues: no valid values in scalar field; ContourPlot
> not possible:[errno=1101]
> warning:VectorPlotInitialize: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
> warning:VectorPlotSetValues: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotSetValues: no valid values in scalar field; ContourPlot
> not possible:[errno=1101]
> warning:VectorPlotInitialize: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
> warning:VectorPlotSetValues: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotSetValues: no valid values in scalar field; ContourPlot
> not possible:[errno=1101]
> warning:VectorPlotInitialize: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
> warning:VectorPlotSetValues: no valid values in vector field; VectorPlot
> not possible:[errno=1101]
> warning:ContourPlotSetValues: no valid values in scalar field; ContourPlot
> not possible:[errno=1101]
> _______________________________________________________________
>
>
> Script
>
>
>
> ***********************************************************
> ;
> ; mjoclivar_16.ncl
> ;
> ;***********************************************************
> ; Generate life cycle composites based upon daily phase space
> ; If the MJO_INDEX is < 1.0 it is not included
> ;
> ; Source: Eun-Pa Lim: Bureau of Meteorology, Australia
> ; July, 2016
> ;***********************************************************
> ;
> ; These files are loaded by default in NCL V6.2.0 and newer
> load "/usr/local/ncarg/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "/usr/local/ncarg/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "/usr/local/ncarg/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>    latS    = -90
>    latN    =  90
>
>    ymdStrt = 20130101                         ; start yyyymmdd
>    ymdLast = 20131231                         ; last
>
>    yrStrt  = ymdStrt/10000
>    yrLast  = ymdLast/10000
>
>    pltSubTitle = "Anomalous: OLR, U850, V850"
>
>    pltDir  = "./"                             ; plot directory
>    pltType = "pdf"                            ; send graphics to PNG file
>    pltName = "mjoclivar"                      ; yrStrt+"_"+yrLast
>
>    diro    =  "./"                            ; output directory
>    diri    =  "./"                            ; input directory
>
>    filo    = "olr.day.anomalies.1979-2013.nc"
>   filu    = "u850.day.anomalies.1979-2013.nc"
>   filv    = "v850.day.anomalies.1979-2013.nc"
>
> ;************************************************
> ; create BandPass Filter
> ;************************************************
>   ihp      = 2                             ; bpf=>band pass filter
>   nWgt     = 201
>   sigma    = 1.0                           ; Lanczos sigma
>   fca      = 1./100.
>   fcb      = 1./20.
>   wgt      = filwgts_lanczos (nWgt, ihp, fca, fcb, sigma )
>
> ;***********************************************************
> ; Find the indicies (subscripts) corresponding to the start/end times
> ;***********************************************************
>
>    f       = addfile (diri+filu , "r")
>    TIME    = f->time                          ; days since ...
>    YMD     = cd_calendar(TIME, -2)            ; entire (time,6)
>
>    iStrt   = ind(YMD.eq.ymdStrt)              ; index start
>    iLast   = ind(YMD.eq.ymdLast)              ; index last
>    delete(TIME)
>    delete(YMD )
>
>    time    = f->time(iStrt:iLast)             ; days since ...
>    u       = f->uwnd_anom(iStrt:iLast,{latS:latN},:)
> ;***********************************************************
> ; Read anomalies frpm other fields
> ;***********************************************************
>    f       = addfile (diro+filv , "r")
>    v       = f->vwnd_anom(iStrt:iLast,{latS:latN},:)
>
>    f       = addfile (diro+filo , "r")
>    x       = f->olr_anom(iStrt:iLast,{latS:latN},:)
>
>    dimx    = dimsizes( x )
>    ntim    = dimx(0)
>    nlat    = dimx(1)
>    mlon    = dimx(2)
> ;************************************************
> ; Apply the band pass filter to the original anomalies
> ;************************************************
>   x   = wgt_runave_leftdim (x, wgt, 0)
>   u   = wgt_runave_leftdim (u, wgt, 0)
>   v   = wgt_runave_leftdim (v, wgt, 0)
>
> ;***********************************************************
> ; Open PC components file created in 'mjo_14.ncl'
> ;***********************************************************
>   dirMJO  = "./"                             ; input directory
>   fMJO    = "MJO_PC_INDEX.nc"                ; created in mjo_14.ncl
>   f       = addfile (dirMJO+fMJO, "r")
>
> ;***********************************************************
> ; Find the indices corresponding to the start/end times
> ;***********************************************************
>   TIME    = f->time                          ; days since ...
>   YMD     = cd_calendar(TIME, -2)            ; entire (time,6)
>
>   iStrt   = ind(YMD.eq.ymdStrt)              ; index start
>   iLast   = ind(YMD.eq.ymdLast)              ; index last
>   delete(TIME)
>   delete(YMD )
>   delete(time)
>
> ;***********************************************************
> ; Read the data for the desired period
> ;***********************************************************
>   pc1     = f->PC1(iStrt:iLast)
>   pc2     = f->PC2(iStrt:iLast)
>   mjo_indx= f->MJO_INDEX(iStrt:iLast)
>
>   time    = pc1&time
>
>   ymdhms  = cd_calendar(time, 0)
>
>   imon    = floattoint( ymdhms(:,1) )   ; convenience
>   iday    = floattoint( ymdhms(:,2) )   ; subscripts must be integer
>
> ;***********************************************************
> ; Coloque cada matriz em uma matriz apropriada
> ;***********************************************************
>   nPhase      = 8
>   angBnd      = new( (/2,nPhase/), "float")
>   angBnd(0,:) = fspan(  0,315,nPhase)
>   angBnd(1,:) = fspan( 45,360,nPhase)
>
>   r2d         = 180./(4.*atan(1.0))
>   ang         = atan2(pc2,pc1)*r2d     ; phase space
>
>   nn          = ind(ang.lt.0)
>
>   ang(nn)     = ang(nn) + 360          ; make 0 to 360
>
> ;----------------------------------------------------------
> ; 0 <= ang < 45 --> MJO Phase 5 (i.e. +ve PC1 & +ve PC2)
> ;
> ;  print(pc1(:19)+"  "+pc2(:19)+"  "+ang(:19))
> ;----------------------------------------------------------
>
>   nDays       = new (nPhase, "integer")
>   pLabel      = "P"+ispan(1,nPhase,1)+": "
>
> ;------------------------------------------------------------
> ; PLOTS
> ;------------------------------------------------------------
>   ; pltPath = pltDir+pltName+"_rv_16"
>   pltPath = pltDir+pltName
>   wks  = gsn_open_wks(pltType,pltPath)
>   plot = new(nPhase,graphic)              ; create graphic array
>
>   res                      = True
>   res at gsnDraw              = False        ; don't draw yet
>   res at gsnFrame             = False        ; don't advance frame yet
>
>   res at mpFillOn             = False        ; turn off map fill
>   res at mpMinLatF            = latS         ; zoom in on map
>   res at mpMaxLatF            = latN
>   res at mpCenterLonF         = 210.
>   res at cnFillOn             = True         ; turn on color fill
>   res at cnFillPalette        = "ViBlGrWhYeOrRe" ; set color map
>   res at cnLinesOn            = False        ; True is default
>   res at cnLineLabelsOn       = False        ; True is default
>   res at lbLabelBarOn         = False        ; turn off individual lb's
>   res at gsnScalarContour     = True         ; contour 3rd array
>   res at gsnMajorLatSpacing   = 15
>   res at gsnMajorLonSpacing   = 60
>   res at tmXBLabelFontHeightF = 0.01
>   res at tmYLLabelFontHeightF = 0.01
>
>                                           ; common contours
>  ;mnmxint = nice_mnmxintvl( min(x) , max(x), 16, False)
>   res at cnLevelSelectionMode = "ManualLevels"
>   res at cnMinLevelValF       =  -40         ; -100; mnmxint(0)
>   res at cnMaxLevelValF       =   40         ;   80; mnmxint(1)
>   res at cnLevelSpacingF      =    5         ;   20; mnmxint(2)
> ;print(res)
>
>   res at vcMinDistanceF            = 0.01            ; thin the vector
> density
>   res at vcRefMagnitudeF           = 2.0             ; define vector ref mag
>   res at vcRefLengthF              = 0.025           ; define length of vec
> ref
>   res at vcRefAnnoOrthogonalPosF   = -1.0            ; move ref vector
>   res at vcRefAnnoArrowLineColor   = "black"         ; change ref vector
> color
>   res at vcRefAnnoArrowUseVecColor = False           ; don't use vec color
> for ref
>
>                                           ; panel plot only resources
>   resP                     = True         ; modify the panel plot
>   resP at gsnMaximize         = True         ; large format
>   resP at gsnPanelLabelBar    = True         ; add common colorbar
>   resP at lbLabelFontHeightF  = 0.01
>   resP at gsnPanelBottom      = 0.05         ; add some space at bottom
>   resP at pmLabelBarWidthF    = 0.8          ; label bar width
>   resP at pmLabelBarHeightF   = 0.05
>   resP at gsnPanelFigureStringsFontHeightF = 0.0125  ; bit larger than
> default
>  ;resP at pmLabelBarOrthogonalPosF = 0.015   ; move labelbar up a bit
>
>   txres                  = True
>   txres at txFontHeightF    = 0.01
>   txid = gsn_create_text(wks, pltSubTitle, txres)
>
>   amres                  = True
>  ;amres at amParallelPosF   =  0.575
>   amres at amOrthogonalPosF =  0.75
>   amres at amJust           = "CenterCenter"
>  ;amres at amResizeNotify   = True
>
> ;*******************************************
> ; Loop over each phase
> ;*******************************************
>  res at gsnLeftString               = ""
>  res at gsnRightString              = ""
>  do nSeason=1,2
>     if (nSeason.eq.1) then
>         resP at gsnPanelMainString  = yrStrt+"-"+yrLast+": May to Oct"
>     else
>         resP at gsnPanelMainString  = yrStrt+"-"+yrLast+": Nov to Apr"
>     end if
>
>   do n=0,nPhase-1
>
>     na = n+4             ; temporary adjustment for 0 <= ang < 45
> represents MJO phase 5 not MJO phase 1
>     if(na.gt.7) then
>       na = na - 8
>     end if
> ;    print(na)
>
>      if (nSeason.eq.1) then
>          nt = ind(mjo_indx.gt.1.0    .and.                     \
>                  (imon.ge.5          .and. imon.le.10).and.    \
>                   ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))
>      else
>          nt = ind(mjo_indx.gt.1.0    .and.                     \
>                  (imon.ge.11         .or.  imon.le. 4).and.    \
>                   ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))
>      end if
>      if (.not.all(ismissing(nt))) then
>          xAvg = dim_avg_Wrap( x(lat|:,lon|:,time|nt) )
>          uAvg = dim_avg_Wrap( u(lat|:,lon|:,time|nt) )
>          vAvg = dim_avg_Wrap( v(lat|:,lon|:,time|nt) )
>          nDays(na) = dimsizes(nt)
>
>          res at tmXBLabelsOn         = False    ; do not draw lon labels
>          res at tmXBOn               = False    ;             lon tickmarks
>          if (n.eq.(nPhase-1)) then           ;
>              res at tmXBLabelsOn     = True     ; draw lon labels
>              res at tmXBOn           = True     ;          tickmarks
>          end if
>
>          plot(n) = gsn_csm_vector_scalar_map(wks,uAvg,vAvg,xAvg,res)
>      end if
>      delete(nt)                  ; will change next iteration
>   end do
>
>   resP at gsnPanelFigureStrings= pLabel+nDays
>   gsn_panel(wks,plot,(/nPhase,1/),resP)     ; now draw as one plot
>  end do
>
> end
> _______________________________________________________________
>
> _______________________________________________
> ncarg-talk mailing list
> ncarg-talk at ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncarg-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncarg-talk/attachments/20181016/24df83f3/attachment-0001.html>


More information about the ncarg-talk mailing list