[Thread Prev][Thread Next][Index]

Re: [ferret_users] loop/i=1:n ( compute(i) & save netCDF(i) )



Hi Ryo -

I think ZAXREPLACE is exactly what you need. ZAXREPLACE functions like a generalization of @weq for converting quantities on a z-axis to another monotonic axis (typically density).

See if this works:

define axis/z=2:32:.1 tempax ! to encompass the full range of temperatures at the desired resolution
let pv_iso = zaxreplace(pv,temp,z[gz=tempax])
save/file=pv_iso.nc pv_iso

Billy K

On Jan 7, 2007, at 9:24 PM, Ryo Furue wrote:

Hello all,

I don't understand Ferret variables/arrays well enough.
Basically, I'd like to compute the horizontal distributions
of potential vorticity (PV) on a series of isotherms and save
the result as a 3D array in the form of pv_iso(x,y,theta),
where theta = 4, 5, 6, . . . (degC) are temperature values.
(Suppose that I already have 3D distributions of temperature
 and PV in an netCDF file.)

I know how to compute the isothermal distribution of PV
for a single isotherm:

   let iso    = temp[z=@weq:4]  !! 4 degC isotherm
   let int    = iso * pv
   let pv_iso = int[z=@sum]

What I'm trying to achieve is 1) to loop over
different temperature values and 2) to gather the results
in a single array and save it in another netCDF file.

In a pseudo-Ferret-Fortran script, what I want to do is

   n = 15                       !! # of isotherms
   theta = [(4 + i, i = 1, n)]  !! theta = {4, 5, 6, . . .}
   set data mydata.nc

   do i = 1, n
      go one_isotherm(i)
   end do

   subroutine one_isotherm(i)
      iso    = temp[z=@weq:theta(i)]  !! the i-th isotherm
      int    = iso * pv
      pv_iso = int[z=@sum]
      save/file=result.nc/append/klimits=1:n/k=i pv_iso
   end subroutine

I read the "Example 4: multiple slabs" part of
"Ch10 Sec2.  SIMPLE CONVERSIONS USING FERRET" in the Ferret manual,
but I couldn't figure out how to loop over isotherms.

Thank you,
Ryo



[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement