Re: trouble with cz2ccm

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 15 Nov 2005 14:41:19 -0700 (MST)

>
>I am trying to use the function cz2ccm to compute the geopotential height.
>
>I understand from the documentation
>(http://www.ncl.ucar.edu/Document/Functions/Built-in/cz2ccm.shtml) that
>the arguments can be a multi-dimensional array, and the rightmost
>dimensions must be:
>- lat,lon for PHIS and PS and
>- level, lat, and lon for Tv
>
>When I use:
> z2 = cz2ccm(ps,phis,tv,p0,hyam(::-1),hybm(::-1),hyai(::-1),hybi(::-1))
>I get an error:
> fatal:Number of dimensions in parameter (1) of (cz2ccm) is (3), (2)
>dimensions were expected
> fatal:Execute: Error occurred at or near line 75
>
>I cannot figure out the problem. Any idea?
--------------------------------------------------------

Yes ... I have an "idea"!
        I will make the assumption that you would like me
        to share it :-)
        
        
        Better, than an "idea", I *know* what is wrong!
        
The answer has a bit of history to it.

In the older versions of the atmospheric model, the "phis"
was constant for all times. Hence, it was 2D.

Recent versions, allow "phis" to change as a funtion of time.
[Not sure but it fluctuates dies to changes in ice ..
maybe other things?]

The "cz2ccm" is *direct* from the old CCM-Processor.
It assumed a 2D phis. It should be changed.
Hopefully, before the next version.

Here is a work-around:
---------------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/ccm_func.ncl"

begin
  
  nc = addfile("/project/ccr/hannay/CAPT/test/GPCI_UW_test1.nc", "r")

  print("Compute Z")
  p0 = 100000. ; get constant
  phis = nc->PHIS ; read PHIS to memory
  hyam = nc->hyam
  hybm = nc->hybm
  hyai = nc->hyai
  hybi = nc->hybi
  ps = nc->PS ; get sfc pres
  tv = nc->T ; read T [keep meta data]
  tv = tv*(1.+0.61*nc->Q) ; calculate virtual temperature
  tv_at_long_name = "virtual Temp"

  dimt = dimsizes(tv)
  ntim = dimt(0)

  z2 = new ( dimt, typeof(tv), getFillValue(tv))
  delete(z2@_FillValue)

  do nt=0,ntim-1 ; calculate z2 at all time steps
     z2(nt,:,:,:) = cz2ccm(ps(nt,:,:),phis(nt,:,:),tv(nt,:,:,:) \
                          ,p0,hyam(::-1),hybm(::-1),hyai(::-1),hybi(::-1))
  end do

  copy_VarCoords(tv, z2)
  z2_at_long_name = "Geopotential Height"
  z2_at_units = "units"

  printVarSummary(z2)
  printMinMax(z2,True)
 
end

        
        
        
        

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 15 2005 - 14:41:19 MST

This archive was generated by hypermail 2.2.0 : Tue Nov 15 2005 - 16:48:16 MST