Re: Problem with Fixed Grid Functions?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 4 Aug 2006 07:07:11 -0600 (MDT)

> I have begun using ncl built in functions to calculate divergence and relative
> vorticity from NCEP Reanalysis data (2.5x2.5). As it is on a fixed grid, I was
> using uv2dvF and uv2vrF. The results came out to the right order of magnitude
> but were not realistic. I did the analysis again using the Centered Finite Diff
> functions and everything seemed to work.
> Any ideas why the fixed grid functions were not working? I also want to
> calculate divergent wind components (dv2uvf) but there does not seem to be a CFD
> function for this (which is why I ask about the problem with the fixed grid
> method).
> My code for the fixed grid method is below.
> Thanks for taking the time to look at this problem.
> -Matthew
> ;===========================================================
> u = a_u->uwnd(:,:,:,:)
> v = a_v->vwnd(:,:,:,:)
> add_offset=202.660003662109
> scale_factor= .00999999977648258
> u_real=add_offset+u*scale_factor
> v_real=add_offset+v*scale_factor
> dv = uv2dvF (u_real,v_real) ; u,v ==> divergence
> ;===========================================================


[1] When reading an entire multidimensional variable it is more
     efficient to use x=f->X rather than xf-X(:,:,:,:)

[2] I speculate that these are file from the Climate Diagnostics
     Center. If so, the variables are of type short.

     I suggeste using the "short2flt" function located
     in contributed to unpack the data.

[3] Also, these CDC data are from north to south order.

     The documentation for all the sprectral function states
     that the data must be in ascending latitude order.

[4] It is not required but it is recommended that variables
     maintain the meta data. It facilitates writing netCDF and
     the gsn_csm* suite of graphical interfaces looks
     for coordinate information associated with variables.

     I recommend that users make frequent use of printVarSummary
     to examine variables during test/debug mode.

[5] When available use the contributed.ncl *_Wrap functions to
     maintain meta data. eg
; untested code

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"


     u = short2flt( a_u->uwnd ) ; unpack and keep meta data
     v = short2flt( a_v->vwnd )

     printVarSummary( u ) ; note latitude order
     printVarSummary( v )

     u = u(:,::-1,:,:) ; reverse lat order
     v = v(:,::-1,:,:)

     printVarSummary( u ) ; note latitude order
     printVarSummary( v )
                                  ; contributed.ncl
     dv = uv2dvF_Wrap (u,v) ; u,v ==> divergence

     printVarSummary( dv ) ; note meta data


See sample plots at:

Under "Data Processing" click "Divergent and rotational wind components"

good luck

ncl-talk mailing list
Received on Fri Aug 04 2006 - 07:07:11 MDT

This archive was generated by hypermail 2.2.0 : Fri Aug 04 2006 - 10:26:32 MDT