[Thread Prev][Thread Next][Index]

Re: [ferret_users] zaxreplace - convert z-axis of density to the z-axis of `m`



Hi Saurabh,

The error message  **ERROR: illegal limits: Z limits of data and depth fields must match
is saying that the translation defined in a call to ZAXREPLACE needs the same number of points along the z-axis of the first and second arguments.

yes? show function zaxreplace
ZAXREPLACE(V,ZVALS,ZAX)
    regrid V onto Z axis of ZAX based upon Z values in ZVALS using linear interpolation
    V: variable on native Z axis
    ZVALS: Z-value field corresponding to data points of V
    ZAX: variable with desired Z (depth) axis points

* V is the input data you want to convert
* ZVALS is the translation. It tells the value at each Z (and perhaps at each x,y,t, etc on the same grid as V), in the new z units.
* ZAX is the axis of the result in the new units.

So, check the grids of arguments 1 and 2 in the call that gave you the error.  ZVALS may have the entire same grid as V, giving the translation from one set of z-units to the other everywhere, or it might be just on the same Z axis as V, but the Z axes must agree.

By the way, there's an alternative syntax for this kind of "auxiliary regridding".  It's a generalization of zaxreplace, and uses the same computations, but can operate in any direction.

let temp_on_density = temp[gz(density)=myDensityAxis]

For more on that, see this FAQ: Depth axis to Density axis

On 5/1/2019 8:32 AM, saurabh rathore wrote:
Dear Ryo,
G'day

Thanks for your explanation but it is still not clear to me. I tried your way but it is showing an error **ERROR: illegal limits: Z limits of data and depth fields must match.

here is my script

use /data/rg/rgsigmaslope.nc
use /data/rg/neutraldensrg.nc

sh gr slope[d=1], NEUTRALRHO[d=2]
    GRID GRC1
 name                  axis            # pts      start         end                 subset
 LONGITUDE  LONGITUDE      360mr   20.5E     19.5E(379.5)        full
 LATITUDE     LATITUDE          145 r    64.5S      79.5N               full
 AXDEN               Z                  118 r    16.81       28.51               full
 normal                T
    GRID GFP1
 name       axis                # pts      start                          end                      subset
 LON       LONGITUDE       360 r    20.5E                       19.5E(379.5)           full
 LAT       LATITUDE           145 r    64.5S                       79.5N                     full
 LEV       DEPTH (dbar)      58 i-     2.4811                     1950.9                     full
 TIME      TIME                 180 i    16-JAN-2004 05:14    16-DEC-2018 10:03  full

define axis/z=`NEUTRALRHO[d=2,x=@min,y=@min,l=@min,z=@min]`:`NEUTRALRHO[d=2,x=@max,y=@max,l=@max,z=@max]`:.1 axden

let zed=z[gz=slope[d=1]] + 0*slope[d=1]

let zedp=zaxreplace(zed, NEUTRALRHO[d=2,gx=slope[d=1],gy=slope[d=1]], z[gz=axden])

set mem/size=5000

define axis/z=`zed[x=@min,y=@min,l=@min,z=@min]`:`zed[x=@max,y=@max,l=@max,z=@max]`:50 zedaxis

let slopez=zaxreplace(slope[d=1],zedp,z[gz=zedaxis])

fill slopez[z=0:700@din]

I am not clear where I am making mistake. This is my firs time using this method.

Cheers, Saurabh

On Wed, May 1, 2019 at 9:24 AM Ryo Furue <furue@xxxxxxxxxx> wrote:
Hi Saurabh,

On Wed, May 1, 2019 at 9:12 PM saurabh rathore <rohitsrb2020@xxxxxxxxx> wrote:

now I want to map it back to the `m` axis of depth which is define by `ohc.nc` so how I should do it ? or Do I map it first to `m` axis and after that I compute the slope ?

When you convert a variable F from the z axis to the ρ axis, you do this:

F_ρ = zaxreplace(F, ρ, denaxis)   . . . . . (1)

The field ρ(x, y, z, t) is the value of density at (x, y, z, t).

Likewise, when you convert a variable G from the ρ axis to the z axis, you do this:

G_z = zaxreplace(G, zed_ρ, zedaxis)

That means that you need the variable "zed_ρ". The field zed_ρ(x, y, ρ, t) is the value of z at (x, y, ρ, t).  That is, it's the depth of the isopycnal ρ at (x, y, t).
 
This zed_ρ can be obtained similarly to (1):

zed_ρ = zaxreplace(zed, ρ, denaxis)

where zed is the "4D distribution of z":

zed = z[gz=F] + 0*F

This "variable" is rather stupid: its value is the depth of each gridpoint (x, y, z, t).

Hope this helps.

Cheers,
Ryo



--


REGARDS

Saurabh Rathore
Research Scholar (PhD.)
Centre For Oceans, Rivers, Atmosphere & Land Science Technology
Indian Institute Of Technology, Kharagpur
contact :- 91- 8345984434
--
Ansley Manke
NOAA/PMEL Science Data Integration Group
7600 Sand Point Way NE
206-526-6246

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement