Re: Ri contours are not appeared in the figure

From: wei huang <whua27_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 16 2011 - 02:07:13 MST

Hi,

Thanks for your response, the data file is heavy sorry I could not send it
please... The details of printVarSummary, printMinMax, and image are
attached. Hope that will be helped to figure out the problem.

thanks

wei
****************

Copyright (C) 1995-2010 - All Rights Reserved

University Corporation for Atmospheric Research

NCAR Command Language Version 5.2.1

The use of this software is governed by a License Agreement.

See http://www.ncl.ucar.edu/ for more details.

Variable: T

Type: float

Total Size: 102667500 bytes

            25666875 values

Number of Dimensions: 4

Dimensions and sizes: [Time | 25] x [bottom_top | 39] x [south_north |
195] x [west_east | 135]

Coordinates:

Number Of Attributes: 6

  FieldType : 104

  MemoryOrder : XYZ

  description : perturbation potential temperature (theta-t0)

  units : K

  stagger :

  coordinates : XLONG XLAT

Variable: u

Type: float

Total Size: 102667500 bytes

            25666875 values

Number of Dimensions: 4

Dimensions and sizes: [Time | 25] x [bottom_top | 39] x [south_north |
195] x [west_east | 135]

Coordinates:

Number Of Attributes: 6

  FieldType : 104

  MemoryOrder : XYZ

  description : x-wind component

  units : m s-1

  stagger :

  coordinates : XLONG XLAT

Variable: v

Type: float

Total Size: 102667500 bytes

            25666875 values

Number of Dimensions: 4

Dimensions and sizes: [Time | 25] x [bottom_top | 39] x [south_north |
195] x [west_east | 135]

Coordinates:

Number Of Attributes: 6

  FieldType : 104

  MemoryOrder : XYZ

  description : y-wind component

  units : m s-1

  stagger :

  coordinates : XLONG XLAT

Variable: z

Type: float

Total Size: 102667500 bytes

            25666875 values

Number of Dimensions: 4

Dimensions and sizes: [Time | 25] x [bottom_top | 39] x [south_north |
195] x [west_east | 135]

Coordinates:

Number Of Attributes: 6

  FieldType : 104

  MemoryOrder : XYZ

  description : Height

  units : m

  stagger :

  coordinates : XLONG XLAT

(0)

(0) perturbation potential temperature (theta-t0): min=275.254
max=502.357

(0)

(0) x-wind component: min=-27.9777 max=49.9323

(0)

(0) y-wind component: min=-18.5696 max=60.0988

(0)

(0) Height: min=130.62 max=20156.4

Variable: U

Type: float

Total Size: 102667500 bytes

            25666875 values

Number of Dimensions: 4

Dimensions and sizes: [Time | 25] x [bottom_top | 39] x [south_north |
195] x [west_east | 135]

Coordinates:

(0)

(0) min=0.00228019 max=62.1447

Variable: dTdz

Type: float

Total Size: 102667500 bytes

            25666875 values

Number of Dimensions: 4

Dimensions and sizes: [Time | 25] x [bottom_top | 39] x [south_north |
195] x [west_east | 135]

Coordinates:

Number Of Attributes: 1

  _FillValue : -999

(0)

(0) min=0.001 max=0.0938801

Variable: dUdz

Type: float

Total Size: 102667500 bytes

            25666875 values

Number of Dimensions: 4

Dimensions and sizes: [Time | 25] x [bottom_top | 39] x [south_north |
195] x [west_east | 135]

Coordinates:

Number Of Attributes: 1

  _FillValue : -999

(0)

(0) min=0.001 max=0.195239

Variable: nsqr

Type: float

Total Size: 102667500 bytes

            25666875 values

Number of Dimensions: 4

Dimensions and sizes: [Time | 25] x [bottom_top | 39] x [south_north |
195] x [west_east | 135]

Coordinates:

Number Of Attributes: 1

  _FillValue : -999

(0)

(0) min=2.07257e-05 max=0.00314973

Variable: RI

Type: float

Total Size: 102667500 bytes

            25666875 values

Number of Dimensions: 4

Dimensions and sizes: [Time | 25] x [bottom_top | 39] x [south_north |
195] x [west_east | 135]

Coordinates:

Number Of Attributes: 1

  _FillValue : -999

(0)

(0) min=0.0011193 max=1793.91

Variable: times

Type: string

Total Size: 200 bytes

            25 values

Number of Dimensions: 1

Dimensions and sizes: [25]

Coordinates:

Number Of Attributes: 2

  description : times in file

  _FillValue : missing

Variable: ri_plane

Type: float

Total Size: 1360000 bytes

            340000 values

Number of Dimensions: 3

Dimensions and sizes: [Time | 25] x [Vertical | 100] x [Horizontal | 136]

Coordinates:

Number Of Attributes: 3

  _FillValue : -999

  description :

  Orientation : Cross-Sesion: (0,84) to (135,84)

(0)

(0) : min=-2263.84 max=1622.94

On Tue, Feb 15, 2011 at 11:20 PM, Mary Haley <haley@ucar.edu> wrote:

> Wei,
>
> If a part of a plot is not showing up, you must examine your data by using
> "printVarSummary", "print(min(x))", "print(max(x))", etc. Since you didn't
> provide a data file, we are unable to run your script and determine if there
> are data values out-of-range. You will have to debug this problem yourself.
>
> You can debug your code by looking at the "contour_ri" plot on its own.
>
> After:
>
> contour_ri = wrf_contour(a,wks,ri_plane(16,:,:),opts_ri)
>
>
> add:
>
> draw(contour_ri)
> frame(wks)
>
> This will cause the "ri" contour plot to be drawn on its own, and you can
> see if it looks correct before it gets overlaid onto the other plot.
>
> If this plot doesn't look okay, then examine the ri_plane(16,:,:) values
> closely, to make sure they are the right units, etc. You can do this by
> printing the min and max of this data, as a start.
>
> Also, look at "opts_ri" closely. Are you using the correct contour levels?
>
> If the plot is okay on its own, then look at the part of your code that's
> doing the overlay. Perhaps one plot is covering up the other one.
>
> --Mary
>
>
>
>
> On Feb 14, 2011, at 8:48 PM, wei huang wrote:
>
> Hi,
> Thanks for all. Iím interested to Ri, so for this I made some assumption to
> calculating it. The code is working but the Ri contours are not appeared in
> the figure, may be my code is not correct. Please could anyone help me to
> figure out the problem? My code and the result are attached.
> thanks
> wei
> = = = = = = =
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
> begin
>
> a = addfile("wrfout_d03_2000-03-20.nc","r")
>
> T = a->T
>
> T = T + 300. ;theta K
>
> u = wrf_user_getvar(a,"ua",-1)
>
> v = wrf_user_getvar(a,"va",-1)
>
> z = wrf_user_getvar(a, "z",-1)
>
> rh = wrf_user_getvar(a,"rh",-1)
>
> U = (u*u+v*v)^(0.5) ; m/sec
>
> copy_VarCoords(u, U )
>
> printVarSummary(U)
>
> printMinMax(U, True)
>
> ;
>
> dTdz = center_finite_diff_n(T,z,False,0,1)
>
> eps = 1e-02 ; eliminate near zero values
>
> dTdz@_FillValue = -999.
>
> dTdz = where(dTdz.lt.eps, dTdz@_FillValue, dTdz)
>
> copy_VarCoords(T, dTdz )
>
> printVarSummary(dTdz)
>
> printMinMax(dTdz, True)
>
> ;
>
> dUdz = center_finite_diff_n(U,z,False,0,1)
>
> eps = 1e-02 ; eliminate near zero values
>
> dUdz@_FillValue = -999.
>
> dUdz = where(dUdz.lt.eps, dUdz@_FillValue, dUdz)
>
> copy_VarCoords(u, dUdz )
>
> printVarSummary(dUdz)
>
> printMinMax(dUdz, True)
>
> ;
>
> nsqr = ((9.8/T)*(dTdz)); Brunt vaisala frequency
>
> copy_VarCoords(T, nsqr)
>
> printVarSummary(nsqr)
>
> printMinMax(nsqr, True)
>
> RI = nsqr/(dUdz)^2 ; to calculate Richardson Number(RI)
>
> copy_VarCoords(u, RI )
>
> printVarSummary(RI)
>
> printMinMax(RI, True)
>
> ;***********************************
>
> wks = gsn_open_wks("pdf","ri")
>
> gsn_define_colormap(wks,"gui_default")
>
> res = True ; Set up some basic plot resources
>
> res@Footer = False
>
> res@NoHeaderFooter = True
>
> pltres = True
>
> ;*******************************
>
> times = wrf_user_list_times (a); get times in the file
>
> ntimes = dimsizes(times) ; number of times in the file
>
> FirstTime = res
>
> mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the file
>
> nd = dimsizes(mdims)
>
> ;do it = 10,10;ntimes-1
>
> ;***************************************
>
> if ( FirstTime ) then ; get height info for labels
>
> zmin = 0.
>
> zmax = max(z)/1000.
>
> nz = floattoint(zmax/2 + 1)
>
> FirstTime = False
>
> end if
>
> ;**************************************
>
> ip = 1 ; Just do the one (constant y coord) plot
>
> opts = True ; setting start and end times
>
> plane = new(4,float)
>
> if(ip .eq. 1) then
>
> plane = (/ 0,84, 200,84 /) ; start x;y & end x;y point
>
> end if
>
> ;
>
> rh_plane = wrf_user_intrp3d(rh,z,"v",plane,0.,opts)
>
> ri_plane = wrf_user_intrp3d(RI,z,"v",plane,0.,opts)
>
> printVarSummary(rh_plane)
>
> dim = dimsizes(rh_plane) ; Find the data span - for use in labels
>
> zspan = dim(0)
>
> ; Options for XY Plots
>
> opts_xy = res
>
> opts_xy@tiYAxisString = "Height (km)"
>
> opts_xy@AspectRatio = 0.75
>
> opts_xy@cnMissingValPerimOn = True
>
> opts_xy@cnMissingValFillColor = 0
>
> opts_xy@cnMissingValFillPattern = 11
>
> opts_xy@tmYLMode = "Explicit"
>
> opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks
>
> opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels
>
> opts_xy@tiXAxisFontHeightF = 0.020
>
> opts_xy@tiYAxisFontHeightF = 0.020
>
> opts_xy@tmXBMajorLengthF = 0.02
>
> opts_xy@tmYLMajorLengthF = 0.02
>
> opts_xy@tmYLLabelFontHeightF = 0.015
>
> opts_xy@PlotOrientation = ri_plane@Orientation
>
> ; Plotting options for RH
>
> opts_rh = opts_xy
>
> opts_rh@pmLabelBarOrthogonalPosF = -0.07
>
> opts_rh@ContourParameters = (/ 10., 90., 10. /)
>
> opts_rh@cnFillOn = True
>
> ; Plotting options for ri
>
> opts_ri = opts_xy
>
> opts_ri@cnInfoLabelOrthogonalPosF = 0.00
>
> opts_ri@ContourParameters = (/10. /)
>
> ; Get the contour info for the rh and ri
>
> contour_ri = wrf_contour(a,wks,ri_plane(16,:,:),opts_ri)
>
> contour_rh = wrf_contour(a,wks,rh_plane(16,:,:),opts_rh)
>
> ; MAKE PLOTS
>
> plot = wrf_overlays(a,wks,(/contour_rh,contour_ri/),pltres)
>
> ; Delete options and fields, so we don't have carry over
>
> delete(opts_ri)
>
> delete(opts_rh)
>
> delete(ri_plane)
>
> delete(rh_plane)
>
> end
> <ri.pdf>_______________________________________________
> 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 16 02:07:40 2011

This archive was generated by hypermail 2.1.8 : Thu Feb 17 2011 - 22:00:17 MST