[ncl-talk] warning:ScalarFieldSetValues: 2d coordinate array sfYArray has an incorrect dimension size: defaulting sfYArray

Karin Meier-Fleischer meier-fleischer at dkrz.de
Thu Jul 7 02:29:25 MDT 2016


Hi Amit,

you are reading only one netCDF file and define the variable var only 
for the first time step. Inside the do loop you only change the 
gsnLeftString and gsnRightString attribute nothing else, so it is 
plotting every time the same data.

Try something like this to plot the next nplot time steps:

var = doubletofloat(a->HEM)
...
do i = 0,nplot-1
      .....
     plot(i) = gsn_csm_contour_map(wks,var(i,:,:),res)
end do


Bye,
Karin

Am 07.07.16 um 09:19 schrieb Amit Kumar:
>
>
> Hi All,
>
>
> I did following two modifications and this error was removed.
>
>
> res at gsnAddCyclic         = False
>
> plot(i) = gsn_csm_contour_map(wks,var,res)
>
>
> But now I'm getting 1st plots data in all the plots. It is displaying 
> only data of 1st nc file in all the plots. It is not reading rest files.
>
>
> Please help me out.
>
>
>
> Regards
> Amit Kumar,
>
>
> ------------------------------------------------------------------------
> *From:* Amit Kumar <amitkumar.777 at hotmail.com>
> *Sent:* Thursday, July 7, 2016 10:52 AM
> *To:* ncl-talk at ucar.edu
> *Subject:* warning:ScalarFieldSetValues: 2d coordinate array sfYArray 
> has an incorrect dimension size: defaulting sfYArray
>
> Hi All,
>
>
> I'm new to NCL, I'm trying to make a panel plot of HEM for a day. so i 
> concatenated all the files into one file using cdo.
>
>
> amit at amit-HP-xw6400-Workstation:~/Desktop/images/output/UK$ cdo infov 
> out2.nc
>
>  -1 :       Date     Time   Level Gridsize    Miss :     
> Minimum        Mean     Maximum : Parameter name
>      1 : 2016-06-30 10:00:00       0     3124       0 :      
> 0.0000     0.18826      28.871 : HEM
>      2 : 2016-06-30 10:30:00       0     3124       0 :      
> 0.0000     0.40692      41.558 : HEM
>      3 : 2016-06-30 11:00:00       0     3124       0 :      
> 0.0000     0.27961      39.316 : HEM
>      4 : 2016-06-30 11:30:00       0     3124       0 :      
> 0.0000     0.39080      54.272 : HEM
>      5 : 2016-06-30 12:00:00       0     3124       0 :      
> 0.0000     0.24352      21.233 : HEM
>      6 : 2016-06-30 12:30:00       0     3124       0 :      
> 0.0000     0.34891      26.116 : HEM
>      7 : 2016-06-30 13:00:00       0     3124       0 :      
> 0.0000     0.31744      20.495 : HEM
>      8 : 2016-06-30 13:30:00       0     3124       0 :      
> 0.0000     0.26712      15.045 : HEM
>      9 : 2016-06-30 14:00:00       0     3124       0 :      
> 0.0000     0.14747      16.468 : HEM
>     10 : 2016-06-30 14:30:00       0     3124       0 :      
> 0.0000     0.21267      46.071 : HEM
>     11 : 2016-06-30 15:00:00       0     3124       0 :      
> 0.0000     0.46982      65.314 : HEM
>     12 : 2016-06-30 15:30:00       0     3124       0 :      
> 0.0000     0.57988      103.28 : HEM
>     13 : 2016-06-30 16:00:00       0     3124       0 :      
> 0.0000     0.34465      232.33 : HEM
>     14 : 2016-06-30 16:30:00       0     3124       0 :      
> 0.0000     0.65428      84.749 : HEM
>     15 : 2016-06-30 17:00:00       0     3124       0 :      
> 0.0000      1.4974      132.02 : HEM
>     16 : 2016-06-30 17:30:00       0     3124       0 :      
> 0.0000      1.3078      121.53 : HEM
>     17 : 2016-06-30 18:00:00       0     3124       0 :      
> 0.0000      1.5186      116.90 : HEM
>     18 : 2016-06-30 18:30:00       0     3124       0 :      
> 0.0000      2.8212      139.77 : HEM
>     19 : 2016-06-30 19:00:00       0     3124       0 :      
> 0.0000      4.9052      283.62 : HEM
>     20 : 2016-06-30 19:30:00       0     3124       0 :      
> 0.0000      3.9615      161.71 : HEM
>     21 : 2016-06-30 20:00:00       0     3124       0 :      
> 0.0000      3.8913      144.44 : HEM
>     22 : 2016-06-30 20:30:00       0     3124       0 :      
> 0.0000      7.5982      232.91 : HEM
>     23 : 2016-06-30 21:00:00       0     3124       0 :      
> 0.0000      2.8257      94.449 : HEM
>     24 : 2016-06-30 21:30:00       0     3124       0 :      
> 0.0000      2.3140      122.16 : HEM
>     25 : 2016-06-30 22:00:00       0     3124       0 :      
> 0.0000      2.4510      107.22 : HEM
>     26 : 2016-06-30 22:30:00       0     3124       0 :      
> 0.0000      3.0760      114.25 : HEM
>     27 : 2016-06-30 23:00:00       0     3124       0 :      
> 0.0000      2.5792      92.298 : HEM
>     28 : 2016-06-30 23:30:00       0     3124       0 :      
> 0.0000      3.4650      120.34 : HEM
> cdo infon: Processed 87472 values from 1 variable over 28 timesteps ( 
> 0.00s )
>
> when i'm trying to plot this  in a panel i'm getting this error, 
> warning:ScalarFieldSetValues: 2d coordinate array sfYArray has an 
> incorrect dimension size: defaulting sfYArray. and the plots are blank.
>
>
> my ncl script is as follows:
>
>
> load "/usr/share/ncarg/nclscripts/csm/gsn_code.ncl"
> load "/usr/share/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "/usr/share/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
>  a = addfile("/home/amit/Desktop/images/output/UK/out2.nc","r")
>  s = "/media/amit/E/India_shapefile/Districtbound(Satmet).shp"
>
>   var     = doubletofloat(a->HEM(0,:,:))
>   lat     =  a->latitude
>   lon     =  a->longitude
>
> wks = gsn_open_wks("png","HEM_30JUN2016") ; send graphics to PNG file
>
>   res                      = True                  ; plot mods desired
>   res at gsnDraw              = False
>   res at gsnFrame             = False
>   res at gsnAddCyclic         = True
>   res at gsnStringFontHeightF = 0.015
>   res at cnFillOn             = True                  ; turn on color fill
>   res at cnLinesOn            = False
>   res at gsnMaximize          = True     ; maximize plot in frame
>   res at mpOutlineOn   = False   ; Use outlines from shapefile
>   res at mpFillOn      = False
>   res at cnLevelSelectionMode = "ExplicitLevels"
>   res at cnLevels             = 
> (/0.1,2.5,15.5,64.5,115.5,204.5,400.5,600.5,800.5/) ; ; 13 contour values
>   res at cnFillPalette        = (/"Snow","LightGoldenRodYellow","Yellow"\ 
> ; 13 contour colors
> ,"Orange","Green","Green4"    \
> ,"Cyan","Blue2","Blue3","Blue4"/)
>
>   res at tiMainString      = "HEM_30JUN2016"
>   res at tiMainFontHeightF = 0.016
>   res at lbLabelBarOn     = False
>   res at lbOrientation   = "Vertical"
>   res at sfXArray             = lon
>   res at sfYArray        =  lat
>   res at mpMinLonF     = 78.0
>   res at mpMaxLonF     = 81.0
>   res at mpMinLatF     = 29.0
>   res at mpMaxLatF     = 31.0
>   res at pmTickMarkDisplayMode     = "Always"
>   res at tiXAxisString            = "Longitude"
>   res at tiYAxisString            = "Lattitude"
>   res at tiXAxisFontHeightF     = 0.02
>   res at tiYAxisFontHeightF     = 0.02
>
> ;create empty graphic plot array
>     nplot = 28
>     plot = new(nplot,"graphic")
>
> ;create the plots
>     do i=0,nplot-1
>         if (i.ne.0) then
>             res at gsnLeftString  = ""
>             res at gsnRightString = ""
>         end if
>         plot(i) = gsn_csm_contour_map_ce(wks,var,res)
>     end do
>
> ;panel res
>     pres = True
>     pres at gsnPanelTop = 0.96
>     pres at gsnPanelBottom = 0.012
>     pres at gsnPanelLabelBar = True
>     pres at pmLabelBarOrthogonalPosF = -0.02
>     pres at txstring = "Panel: 3 X 3 + Common label and title"
>     pres at txFontHeightF = 0.020
>     pres at txPosXF = 0.5
>     pres at txPosYF = 0.85
>     pres at txJust = "CenterCenter"
>
> gsn_panel(wks,plot,(/7,4/),pres)
>
> end
>
> variable summary is as follows:
>
>
> Variable: var
> Type: float
> Total Size: 12496 bytes
>             3124 values
> Number of Dimensions: 2
> Dimensions and sizes:    [44] x [71]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue :    -9e+33
>
>
> Please help me out of this
>
>
>
> Regards
> Amit Kumar,
>
>
> _______________________________________________
> 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/20160707/498278f5/attachment.html 


More information about the ncl-talk mailing list