Re: fatal:Conditional statements (if and do while) require SCALAR logical values, see all and any functions

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 22 2012 - 11:13:27 MST

The problem appears to be with you settings for mpRightCornerLatF and mpRightCornerLonF:

  mpRightCornerLonF : ( -32.06448, -18.5047 )
  mpRightCornerLatF : ( 69.61206, 59.33691 )

Make sure you set these to scalar values, and not arrays.

resm@mpRightCornerLatF = lat(dimsizes(lat)-1,0)
resm@mpRightCornerLonF = lon(dimsizes(lon)-1,0)

I'm surprised the above even worked, given that lat and lon are 2D arrays. I think what you want is this:

latlon_dims = dimsizes(lat)
nlat = latlon_dims(0)
nlon = latlon_dims(1)
resm@mpRightCornerLatF = lat(nlat-1,0)
resm@mpRightCornerLonF = lon(nlat-1,0)

Or, what I think you really want is this:

resm@mpRightCornerLatF = lat(nlat-1,nlon-1)
resm@mpRightCornerLonF = lon(nlat-1,nlon-1)

--Mary

On Feb 22, 2012, at 10:34 AM, ahmed lasheen wrote:

> thanks for your help
> i have attached the output and the output of print(resm)
>
> Copyright (C) 1995-2011 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 6.0.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> (0) get_polar_type: Warning: No polar projection has been selected. Defaulting to northern hemisphere.
> cp: cannot stat `ahmed_red_blue.rgb': No such file or directory
>
>
> Variable: for_time_print
> Type: string
> Total Size: 200 bytes
> 25 values
> Number of Dimensions: 1
> Dimensions and sizes: [25]
> Coordinates:
> (0) 12Z FRI 25 Apr 1986
> (1) 18Z FRI 25 Apr 1986
> (2) 00Z SAT 26 Apr 1986
> (3) 06Z SAT 26 Apr 1986
> (4) 12Z SAT 26 Apr 1986
> (5) 18Z SAT 26 Apr 1986
> (6) 00Z SUN 27 Apr 1986
> (7) 06Z SUN 27 Apr 1986
> (8) 12Z SUN 27 Apr 1986
> (9) 18Z SUN 27 Apr 1986
> (10) 00Z MON 28 Apr 1986
> (11) 06Z MON 28 Apr 1986
> (12) 12Z MON 28 Apr 1986
> (13) 18Z MON 28 Apr 1986
> (14) 00Z TUE 29 Apr 1986
> (15) 06Z TUE 29 Apr 1986
> (16) 12Z TUE 29 Apr 1986
> (17) 18Z TUE 29 Apr 1986
> (18) 00Z WED 30 Apr 1986
> (19) 06Z WED 30 Apr 1986
> (20) 12Z WED 30 Apr 1986
> (21) 18Z WED 30 Apr 1986
> (22) 00Z THR 01 May 1986
> (23) 06Z THR 01 May 1986
> (24) 12Z THR 01 May 1986
> removed directory: `../output/mm5/surface'
> (0) working on the ../output/mm5/surface/000.png map at_time 12Z FRI 25 Apr 1986 Forcast Hours
>
>
> Variable: resm
> Type: logical
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> Number Of Attributes: 28
> gsnFrame : False
> gsnDraw : False
> gsnCenterString : Egyptian Meteorological Authority~C~Cairo Numerical Weather prediction Center
> gsnCenterStringOrthogonalPosF : 0.15
> gsnCenterStringFontHeightF : 0.013
> gsnRightString : Forcast Time 12Z FRI 25 Apr 1986 ~C~Intial time 12Z FRI 25 Apr 1986 ~C~WRF NMM 0 Hrs forcast
> gsnRightStringOrthogonalPosF : 0.01
> gsnRightStringFontHeightF : 0.009
> gsnLeftString :
> gsnLeftStringOrthogonalPosF : 0.05
> gsnLeftStringFontHeightF : 0.01
> gsnStringFont : triplex_italic
> mpDefaultFillColor : True
> mpFillOn : False
> mpNationalLineThicknessF : 1
> mpGeophysicalLineThicknessF : 1
> mpGeophysicalLineColor : black
> mpOutlineBoundarySets : AllBoundaries
> mpOutlineOn : True
> pmTickMarkDisplayMode : True
> mpRightCornerLonF : ( -32.06448, -18.5047 )
> mpRightCornerLatF : ( 69.61206, 59.33691 )
> mpLeftCornerLonF : -2.823425
> mpLeftCornerLatF : 26.38985
> mpLimitMode : Corners
> mpProjection : CylindricalEquidistant
> tfDoNDCOverlay : True
> gsnMaximize : True
> (0) True
> (0) we are hereeeeeeeeeeeeeeeeeeeeeeeeeeeee
> fatal:Conditional statements (if and do while) require SCALAR logical values, see all and any functions
> fatal:Execute: Error occurred at or near line 5553 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
>
> fatal:Execute: Error occurred at or near line 6357 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
>
> fatal:Execute: Error occurred at or near line 270 in file mm5_surface.ncl
>
> thanks for your help
>
>
>
> On Wed, Feb 22, 2012 at 6:41 PM, Mary Haley <haley@ucar.edu> wrote:
> Ahmed,
>
> Without being able to run your script, I don't know what the problem is. It appears it is happening in gsn_csm_map, according to the error message.
> Does it give you any more information about line numbers?
>
> What version of NCL do you have?
>
> One thing that might be a problem is if any of your "resm" resource settings are arrays, when they are supposed to be scalars.
>
> Add this line:
>
> print(resm)
>
> and carefully look at the resource list to see if any of the values are arrays, rather than scalars.
>
> --Mary
>
>
> On Feb 22, 2012, at 7:56 AM, ahmed lasheen wrote:
>
> > Hello
> > i write script to plot mm5 netcdf file, it give me the following error
> > fatal:Conditional statements (if and do while) require SCALAR logical values, see all and any functions
> > i have no all or any function and though i have the previous error.
> > the error is in line 273
> > plot_m =gsn_csm_map(wks,resm)
> > , i put before and after this line print statement .and the print after this line doesn't appear.
> > i donot know exactly what is wrong.
> > i have attached the file.
> > thanks in advance
> > --
> > ===============
> > Ahmed Lasheen
> > Junior researcher at Cairo Numerical Weather Prediction Center (CNWPC)
> > Egyptian Meteorological Authority(EMA)
> > Cairo,Egypt
> > ===============
> >
> > <mm5_surface.ncl>_______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
> --
> ===============
> Ahmed Lasheen
> Junior researcher at Cairo Numerical Weather Prediction Center (CNWPC)
> Egyptian Meteorological Authority(EMA)
> Cairo,Egypt
> ===============
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 22 11:13:40 2012

This archive was generated by hypermail 2.1.8 : Thu Feb 23 2012 - 10:01:53 MST