<div dir="ltr"><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333339691162px;line-height:16px;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif">Paolina, </font></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333339691162px;line-height:16px;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif">I think you're doing more than you need to. Take another look at the function page (linked below). The second argument should be a string either "X", "Y", or "Z". Your variables already have this info attached to the variables "<span style="line-height:normal;color:rgb(34,34,34)">stagger : Y". </span></font></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;border-style:solid;border-width:0px 0px 15px;border-color:transparent"><font face="arial, helvetica, sans-serif" style><a href="https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_unstagger.shtml">https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_unstagger.shtml</a><font><br></font></font></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333339691162px;line-height:16px;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"><span style="line-height:normal;color:rgb(34,34,34)"><font face="arial, helvetica, sans-serif">Therefore I think you can skip straight from the read in line to the unstagger line and change the unstagger commands to as below:</font></span></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333339691162px;line-height:16px;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333339691162px;border-style:solid;border-width:0px 0px 15px;border-color:transparent"><font face="arial, helvetica, sans-serif"> u = <strong style="margin:0px;padding:0px">wrf_user_unstagger</strong>(U,U@stagger)</font><font face="courier"><br></font></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333339691162px;border-style:solid;border-width:0px 0px 15px;border-color:transparent"><font face="arial, helvetica, sans-serif"><br></font></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333339691162px;border-style:solid;border-width:0px 0px 15px;border-color:transparent"><font face="arial, helvetica, sans-serif">Good luck, </font></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333339691162px;border-style:solid;border-width:0px 0px 15px;border-color:transparent"><font face="arial, helvetica, sans-serif">Alan Brammer</font></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333339691162px;border-style:solid;border-width:0px 0px 15px;border-color:transparent"><font face="arial, helvetica, sans-serif"><br></font></pre></pre><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 12:12 PM, Paolina Bongioannini Cerlini <span dir="ltr"><<a href="mailto:paolina.cerlini@unipg.it" target="_blank">paolina.cerlini@unipg.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi NCL people,<br>
<br>
I have this simple script where I am trying to calculate a divergence<br>
but I have a staggered C grid. Trying to unstagger the grid ,<br>
I cannot define correctly the staggered dimensions, as you may see in the<br>
error:<br>
<br>
-------------------------------------------------------------------------------------------------------------------<br>
;*************************************************<br>
; wind_1.ncl<br>
;*************************************************<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<br>
;*************************************************<br>
begin<br>
;*************************************************<br>
; open file and read in data: data are on Arakawa C grid<br>
;*************************************************<br>
f = addfile("<a href="http://rce-bret-2005.net000000.nc" target="_blank">rce-bret-2005.net000000.nc</a>","r")<br>
U = f->U(0,0,:,:)<br>
V = f->V(0,0,:,:)<br>
<br>
printVarSummary(U)<br>
printVarSummary(V)<br>
<br>
U!0="y"<br>
U!1="x_stag"<br>
xstag=ispan(1,195,1)<br>
U@x_stag=xstag<br>
x_stag=U@x_stag<br>
V!0="y_stag"<br>
V!1="x"<br>
V@y_stag=ispan(1,195,1)<br>
y_stag=V@y_stag<br>
<br>
u = wrf_user_unstagger(U,x_stag)<br>
v = wrf_user_unstagger(V,y_stag)<br>
printVarSummary(u)<br>
printVarSummary(v)<br>
<br>
;*************************************************<br>
; calculate divergence: Use Wrap to include meta data<br>
;*************************************************<br>
div = uv2dvG_Wrap(u,v) ; u,v ==> divergence<br>
<br>
;*************************************************<br>
; calculate divergent wind components<br>
;*************************************************<br>
ud = new ( dimsizes(u), typeof(u), u@_FillValue )<br>
vd = new ( dimsizes(v), typeof(v), v@_FillValue )<br>
<br>
dv2uvg(div,ud,vd) ; div ==> divergent wind components<br>
<br>
copy_VarCoords(u, ud )<br>
copy_VarCoords(u, vd )<br>
ud@long_name = "Zonal Divergent Wind"<br>
ud@units = u@units<br>
vd@long_name = "Meridional Divergent Wind"<br>
vd@units = v@units<br>
;*************************************************<br>
; plot results<br>
;*************************************************<br>
wks = gsn_open_wks("ps","wind") ; open a workstation<br>
<br>
res = True<br>
res@vcRefMagnitudeF = 3. ; make vectors larger<br>
res@vcRefLengthF = 0.050 ; reference vector length<br>
res@vcGlyphStyle = "CurlyVector" ; turn on curly vectors<br>
res@vcMinDistanceF = 0.012 ; thin the vectors<br>
<br>
res@gsnLeftString = "Divergent Wind"<br>
; plot 1st time step<br>
plot= gsn_csm_vector_map_ce(wks,ud(0,:,:),vd(0,:,:),res)<br>
<br>
end<br>
--------------------------------------------------------------------------------------<br>
I get this error:<br>
Variable: U<br>
Type: float<br>
Total Size: 151320 bytes<br>
37830 values<br>
Number of Dimensions: 2<br>
Dimensions and sizes: [y | 194] x [x_stag | 195]<br>
Coordinates:<br>
x_stag: [-3000..579000]<br>
Number Of Attributes: 5<br>
Time : 3600<br>
standard_name : x_wind<br>
long_name : U-velocity<br>
units : m s-1<br>
stagger : X<br>
<br>
Variable: V<br>
Type: float<br>
Total Size: 151320 bytes<br>
37830 values<br>
Number of Dimensions: 2<br>
Dimensions and sizes: [y_stag | 195] x [x | 194]<br>
Coordinates:<br>
y_stag: [-3000..579000]<br>
Number Of Attributes: 5<br>
Time : 3600<br>
standard_name : y_wind<br>
long_name : V-velocity<br>
units : m s-1<br>
stagger : Y<br>
warning:Argument 1 of the current function or procedure was coerced to the appropriate type and thus will not change if the function or procedure modifies its value<br>
fatal:Conditional statements (if and do while) require SCALAR logical values, see all and any functions<br>
fatal:["Execute.c":8567]:Execute: Error occurred at or near line 536 in file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl<br>
<br>
fatal:["Execute.c":8567]:Execute: Error occurred at or near line 29 in file wind_1.ncl<br>
<br>
-------------------------------------------------------------------------------------------------------------<br>
Thank you.<br>
<br>
paolina<br>
--<br>
--<br>
Dr. Paolina Bongioannini Cerlini Ph.D.<br>
University of Perugia<br>
Dip.to Ingegneria<br>
CIRIAF -room 8<br>
Via G. Duranti, 67<br>
06125 - Perugia<br>
<br>
Tel.+39 075 585 3576<br>
Fax +39 075 585 3697<br>
e-mail: <a href="mailto:paolina.cerlini@unipg.it">paolina.cerlini@unipg.it</a><br>
<a href="mailto:paolina.cerlini@fisica.unipg.it">paolina.cerlini@fisica.unipg.it</a><br>
cell.:<a href="tel:%2B39%203405761980" value="+393405761980">+39 3405761980</a><br>
--<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div></div>