NCL is an array language. Using arrays is *much* faster
and makes for cleaner code
Replace
w1=u1l
w2=u1l
do i=0,71
do j=0,75
do k=0,99
; aa=(u1l(i,j,k)^2) + (v1l(i,j,k)^2)
; bb=(u2l(i,j,k)^2) + (v2l(i,j,k)^2)
w1(i,j,k) = sqrt((u1l(i,j,k)*u1l(i,j,k))+(v1l(i,j,k)*v1l(i,j,k)))
w2(i,j,k) = sqrt((u2l(i,j,k)*u2l(i,j,k))+(v2l(i,j,k)*v2l(i,j,k)))
w = w1-w2
end do
end do
end do
With
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
w1 = sqrt(u1l^2+v1l^2)
w2 = sqrt(u2l^2+v2l^2)
w = w1-w2
or, directly
w = sqrt(u1l^2+v1l^2) - sqrt(u2l^2+v2l^2
then
copy_VarCoords(u1i, w)
w@long_name = "wind speed difference"
w@units = u1l@units
printVarSummary(w)
wtvg = dim_avg_n_Wrap(w,0) ;time averaging data
printVarSummary(wtvg)
wtvg@lat2d = fn1->XLAT(0,:,:)
wtvg@lon2d = fn1->XLONG(0,:,:)
On 1/10/12 8:44 PM, zhangbinrc wrote:
> *Hi,*
>
> *I want to figure the surface wind speed difference of two simulations.
> And the log comes as :*
> (0) is_valid_latlon2d_attr: Warning: The 'lat2d' attribute must either
> be the same dimension sizes as the data, or one element larger in both
> directions. Your data will most likely not be overlaid on the map
> correctly.
> (0) check_for_y_lat_coord: Warning: Data either does not contain a valid
> latitude coordinate array or doesn't contain one at all.
> (0) &n bsp; A valid latitude coordinate array should have a 'units'
> attribute equal to one of the following values:
> (0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
> 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> (0) is_valid_latlon2d_attr: Warning: The 'lon2d' attribute must either
> be the same dimension sizes as the data, or one element larger in both
> directions. Your data will most likely not be overlaid on the map
> correctly.
> (0) check_for_lon_coord: Warning: Data either does not contain a valid
> longitude coordinate array or doesn't cont ain one at all.
> (0) A valid longitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east
>
> *Could you please help me with this? attached is my ncl script.
>
> Bin*
>
>
>
>
>
>
>
>
> _______________________________________________
> 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 Jan 10 21:31:23 2012
This archive was generated by hypermail 2.1.8 : Wed Jan 18 2012 - 09:21:55 MST