Re: fatal:Div: operator failed, can't continue

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 01 2011 - 07:53:29 MST

Wei, You should do your own debugging. The best approach
is to use "printVarSummary", print min and max values and,
sometimes "print".

If you did that, you would see that RH=1/RH
and then later qs = (qv/RH)*100 was actually qs= (qv*RH)*100

    qv = a->QVAPOR
    P = a->P ; perturbation
    Pb = a->PB ; base state pressure
    P = P + Pb ; total pressure
    theta = a->T ; perturbation potential temperature
(theta+t0)

    theta = theta + 300.

    TK = wrf_tk (P, theta)
    print("min(TK)="+min(TK)+" max(TK)="+max(TK))

    RH = wrf_rh (qv, P, TK) ; %
    printVarSummary(RH)
    print("min(RH)="+min(RH)+" max(RH)="+max(RH))

    eps = 1e-2 ; eliminate near zero values
    RH@_FillValue = -999.
    RH = where(RH.lt.eps, RH@_FillValue, RH)
    print("min(RH)="+min(RH)+" max(RH)="+max(RH))

; No... RH is no longer %
  ;;RH = 1. / RH
  ;;print("min(RH)="+min(RH)+" max(RH)="+max(RH))
  ;;printVarSummary(RH)

    qs = (qv/RH)*100
    copy_VarMeta(qv, qs )
    qs@long_name = "Saturation Mixing Ratio"

    printVarSummary(qs)
    printMinMax( qs, True )

On 1/31/11 9:39 PM, wei huang wrote:
> Dear Respected Dr. Shea and Andrea,
>
> Many thanks for your cooperation. The code is working fine, please would
> you like to have a look on it. I want to confirm is it ok or not?
> thanks again,
> ********************************
>
> qv = a->QVAPOR
>
> P= a->P; perturbation
>
> Pb = a->PB; base state pressure
>
> P= P + Pb; total pressure
>
> theta = a->T; perturbation potential temperature (theta+t0)
>
> theta = theta + 300.
>
> TK = wrf_tk (P, theta)
>
> RH = wrf_rh (qv, P, TK)
>
> RH@_FillValue = -999
>
> RH = where(RH.ne.0,RH,RH@_FillValue)
>
> RH = 1. / RH
>
> print("min(RH)="+min(RH)+"max(RH)="+max(RH))
>
> printVarSummary(RH)
>
> qs = (qv/RH)*100
>
> copy_VarCoords(qv, qs )
>
> printMinMax( qs, True )
>
> printVarSummary(qs)
>
> end
>
> ;*********************************
>
> (0)min(RH)=0.01max(RH)=1.73741e+23
>
> Variable: RH
>
> Type: float
>
> Total Size: 102667500 bytes
>
> 25666875 values
>
> Number of Dimensions: 4
>
> Dimensions and sizes:[Time | 24] x [bottom_top | 39] x [south_north |
> 160] x [west_east | 105]
>
> Coordinates:
>
> Number Of Attributes: 3
>
> _FillValue :-999
>
> units :%
>
> description : Relative Humidity
>
> (0)
>
> (0)min=0max=116.133
>
> Variable: qs
>
> Type: float
>
> Total Size: 102667500 bytes
>
> 25666875 values
>
> Number of Dimensions: 4
>
> Dimensions and sizes:[Time | 24] x [bottom_top | 39] x [south_north |
> 160] x [west_east | 105]
>
> Coordinates:
>
> Number Of Attributes: 1
>
> _FillValue :-999
>
>
>
> On Tue, Feb 1, 2011 at 12:24 AM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>> wrote:
>
> I am sure that if you print the minimum value
> of RH you will see that it is zero.
>
> eg
>
> print("min(RH)="+min(RH)+" max(RH)="+max(RH))
> min(RH)=0 max(RH)=.....
>
> Hence,
>
> qs = (qv/RH)*100
>
> will fail.
>
> You can use the "where" function
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml
>
> Please read the "Description" section. In particular, the
> "Caveat" section
>
> Good luck
>
>
> On 1/31/11 9:07 AM, wei huang wrote:
>
> Thanks for your cooperation, kindly, I have changed the pressure
> hPa to
> Pa but still it does not working and giving the same error: Any help
> will be appreciated.
> thanks
>
> P= a->P; perturbation; Pa
>
> Pb = a->PB; base state pressure; Pa
>
> P= P + Pb; total pressure
>
> T = a->T; perturbation potential temperature
>
> tk = T + 300.
>
> qv = a->QVAPOR; water vapor mixing ratio(kg/kg)
>
> RH = wrf_rh (qv, P, tk)
>
> printVarSummary(RH)
>
> qs = (qv/RH)*100
>
> printVarSummary(qs)
>
> Error:
>
> fatal:divide: Division by 0, Can't continue
>
> fatal:Div: operator failed, can't continue
>
> fatal:Execute: Error occurred at or near line 17 in file
>
>
>
> On Mon, Jan 31, 2011 at 11:36 PM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>
> <mailto:shea@ucar.edu <mailto:shea@ucar.edu>>> wrote:
>
> Please read the documentation:
> http://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_rh.shtml
>
> ==
> "qv" must be kg/kg , you are passing "g/kg"
> "P" must be "Pa", you are passing "hPa"
>
>
>
> On 1/31/11 7:09 AM, wei huang wrote:
>
> Dear NCL users,
>
> I got an error to calculating saturated mixing ratio
> from the
> wrf water
> vapor mixing ratio. I donít know my assumption is correct or
> not. Could
> anyone help me to figure out the problem or any advice
> about it?
>
> Thanks
>
> wei
> a = addfile("wrfout_02.nc <http://wrfout_02.nc/>
> <http://wrfout_02.nc/>
> <http://wrfout_02.nc <http://wrfout_02.nc/>
> <http://wrfout_02.nc/>>","r")
>
>
>
> P= a->P; perturbation
>
> Pb = a->PB; base state pressure
>
> P= P + Pb; total pressure
>
> T = a->T; perturbation potential temperature
>
> tk = T + 300.
>
> qv = a->QVAPOR/1000; water vapor mixing ratio(g/kg)
>
> RH = wrf_rh (qv, P*.01, tk) ;P*0.01 converts Pa to hPa
>
> printVarSummary(RH)
>
> qvs = (qv/RH)*100; saturated water vapor mixing ratio(g/kg)
>
> printVarSummary(qvs)
>
> end
>
> ;*****************************************
>
> Variable: RH
>
> Type: float
>
> Total Size: 102667500 bytes
>
> 25666875 values
>
> Number of Dimensions: 4
>
> Dimensions and sizes:[24] x [39] x [south_north | 160] x
> [west_east | 105]
>
> Coordinates:
>
> Number Of Attributes: 2
>
> units :%
>
> description : Relative Humidity
>
> fatal:divide: Division by 0, Can't continue
>
> fatal:Div: operator failed, can't continue
>
> fatal:Execute: Error occurred at or near line 16 in file
>
>
>
> _______________________________________________
> 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
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 1 07:53:34 2011

This archive was generated by hypermail 2.1.8 : Fri Feb 04 2011 - 09:26:53 MST