Re: global coordinate for wrf regional modeling ?

From: So-Young Ha <syha_at_nyahnyahspammersnyahnyah>
Date: Wed, 22 Apr 2009 21:20:09 -0600

Yan,

If you just want to check the data roughly, why don't you use ncview
and ncdump first?
[ ex. ncview met_em.d01.1996-01-01_00:00:00.nc
         or
         ncdump met_em.d01.1996-01-01_00:00:00.nc | more ]

If you still want to write your own ncl script, it would be easier to
plot the wrfinput file instead of the met_em file since the function
WRF_map_c is designed to read wrfinput or wrfout files, not WPS files.
If the met_em file is wrong, wrfinput will look funny too.

Anyhow, there are a few things to modify in your script.
First, you don't need to read the geogrid file to get the map
information since the met_em file has the exact same map fields in it.
(You can check them using ncdump.)
So you don't need fmap, and can use the file "f" for the map info.
The actual error in your script is a mismatch of the dimension array
between the fields to plot (i.e., sm and sst) and the map fields (i.e.,
XLAT_U and XLONG_U).
You can easily check this by "printVarSummary(sm)" and
"printVarSummary(XLAT_U)".
You should read the map fields on the mass grid (i.e., XLAT_M and
XLONG_M) instead.

Cheers,

Soyoung

On Apr 22, 2009, at 8:01 PM, Yan Bao wrote:

> Hi, Dear all,
>      My script are like the following to check if I can get the
> correct met data to drive wrf model. As a result, I got something with
> grobal coordinate(-90,90; -180,180) for a regional simulation( Like
> California, Lambert projection). 
>
> My ncl script is as following:I don't think the pink lines work for
> the scripts. The wrf_map_c line always some error like :
> WRF_resLamCon_c: unexpected lat/lon rank: rank=1; 
> Also, whether I chose the True or False ( In this case, I have removed
> the wrf_map_c line), the  coordinate is global one.
> Any suggestions?
>
>       Thanks very much for your help.
>
>       Yan 
>
> ;*************************************************
> ; WRF: plot data with "missing_values"
> ;************************************************
> 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/WRF_contributed.ncl"
>
> begin
> ;************************************************
> ; open file 
> ; (1) Read SST and SMOIS at specified time/level
> ; (2) Read character variable Times; Convert to string for plots
> ;************************************************
>   f       = addfile ("met_em.d01.1996-01-01_00:00:00.nc", "r")
>   fmap    = addfile ("geo_em.d01.nc", "r")
>   sm      = f->SM000010(0,:,:)      ; (Time, soil_layers_stag,
> south_north, west_east )
>   sm@_FillValue = 1.0               ; manually set _FillValue 
>   sst     = f->SKINTEMP(0,:,:)          ; (Time, south_north,
> west_east )
>   sst@_FillValue = 0.0              ; manually set _FillValue
>
>   times   = chartostring(f->Times)  ; convert to type string
>   ntim    = dimsizes(times)         ; # time steps
>
> ;************************************************
> ; create plots  
> ;************************************************
>   wks = gsn_open_wks("ps"  ,"WRF_test")          ; ps,pdf,x11,ncgm,eps
>   gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map
>
>   res                       = True             ; plot mods desired
> ;;res_at_gsnMaximize           = True             ; uncomment to maximize
> size
>   res_at_gsnSpreadColors       = True             ; use full range of
> colormap
>   res_at_cnFillOn              = True             ; color plot desired
>   res_at_cnLinesOn             = False            ; turn off contour lines
>   res_at_cnLineLabelsOn        = False            ; turn off contour
> labels
>   res_at_lbLabelAutoStride     = True             ; let NCL figure lb
> stride
>   res_at_lbOrientation         = "Vertical"       ; default is horizontal 
> ;************************************************
> ; Use WRF_contributed procedure to set map resources
> ;************************************************
> ; WRF_map_c(fmap, res, 0)                   ; reads info from file
>
> ;************************************************
> ; if appropriate, set True for native (direct) mapping (faster)
> ;************************************************
>   res_at_tfDoNDCOverlay       = False      
> ; res_at_tfDoNDCOverlay       = True      
>
> ;************************************************
> ; associate the 2-dimensional coordinates to the variable for plotting
> ;************************************************
>   if (.not.res_at_tfDoNDCOverlay) then
> ;      lat2d     = fmap->XLAT_U(0,50:100,50:100)              
>  ;     lon2d     = fmap->XLONG_U(0,50:100,50:100)      
>       lat2d     = fmap->XLAT_U(0,:,:)              
>      lon2d     = fmap->XLONG_U(0,:,:)      
>       sm_at_lat2d  = lat2d
>       sm_at_lon2d  = lon2d
>       sst_at_lat2d = lat2d
>       sst_at_lon2d = lon2d
>   end if
>
> ;************************************************
> ; For individual plots 
> ;************************************************
>   res_at_gsnDraw               = False            ; do not draw 
>   res_at_gsnFrame              = False            ; do not advance 'frame'
> ;************************************************
> ; Allocate array to store plots: specify time step
> ;************************************************
>   plts = new (2 , "graphic")                   ; 1d array to hold plots
>
> ;************************************************
> ; NCL contouring does not like _FillValue=0.0
> ;************************************************
>   sst@_FillValue = -999.                       ; change to -999
>
> ;************************************************
> ; create panel: panel plots have their own set of resources
> ; for demo: use Raster fo soil moisture 
> ;************************************************
>   resP                  = True                   ; modify the panel
> plot
>   resP_at_gsnMaximize      = True                   ; maximize panel area
>
>   res_at_cnFillMode     = "RasterFill"              ; turn raster on    
>     
>   plts(0) = gsn_csm_contour_map(wks,sm,res)
>   delete(res_at_cnFillMode)                     ; delete raster mode
>   plts(1) = gsn_csm_contour_map(wks,sst,res)
>
>   resP_at_txString      = times(0)      
>   gsn_panel(wks,plts,(/2,1/),resP)               ; now draw as one plot
> end
>
>
> _______________________________________________
> 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 Apr 22 2009 - 21:20:09 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 24 2009 - 14:12:40 MDT