[Thread Prev][Thread Next][Index]

Re: [ferret_users] Re griding z-axis into standard depths



Hi,
We'll be making an FAQ about Argo float files, as they are an important data source, but are in a form that's not quite transparent for Ferret's use.

The Argo float data has a particular form for netCDF files.  When you open the data and do a "SHOW DATA" command, you'll see a number of descriptive variables, location and time variables, and then the data the float has measured, on a 2-D grid.  Picking out just the TEMP variable from the output of SHOW DATA:

yes? use 20011217_prof
yes? show data
  TEMP     Sea temperature in-situ ITS-90   1:91 ...   1:4   ...   ...   ...

yes? show grid temp
    GRID GED4
 name       axis      # pts   start      end       subset
 N_LEVELS  X           91 r   1          91        full
 normal    Y
 N_PROF    Z            4 r   1           4        full
 normal    T
 normal    E
 normal    F
The dimensions N_LEVELS and N_PROF don't have coordinate variables associated with them in the Argo float files, so there are no directional attributes to use in assigning the direction for these axes. When it initializes the file, Ferret has put them on the x and z axes, which is not where we'd like to work with them.  Ferret has functions that will help:
yes? show func *transpose*
TRANSPOSE_XZ(VAR)
    transposes x and z axes of given variable
    VAR: variable to transpose in X and Z

! So define a variable with temperature, transposing the axes
yes? let trans_temp= transpose_xz(temp)

We will want to define a depth axis and use depth information from the dataset to translate levels to depths.  Use Ferret's ZAXREPLACE function which takes our input variable, a z-axis definition, and a variable that relates depth and z-levels, to translate the levels to depths.
yes? show func 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
trans_temp, defined above, will be argument 1 to the function ZAXREPLACE.  Now what depth information is in the file?  There is a variable PRES_ADJUSTED.  Look at its attributes:
yes? show attributes pres_adjusted
     attributes for dataset: ./20011217_prof.nc
 PRES_ADJUSTED.long_name = Sea water pressure, equals 0 at sea-level
 PRES_ADJUSTED.standard_name = sea_water_pressure
 PRES_ADJUSTED._FillValue = 99999
 PRES_ADJUSTED.units = decibar
 PRES_ADJUSTED.valid_min = 0
 PRES_ADJUSTED.valid_max = 12000
 PRES_ADJUSTED.C_format = %7.1f
 PRES_ADJUSTED.FORTRAN_format = F7.1
 PRES_ADJUSTED.resolution = 0.1
PRES_ADJUSTED tells what pressure corresponds to each zlevel for each profile. Use pressure as a proxy for depth. PRES_ADJUSTED is on the same grid as TEMP, so transpose it as well.  This will be the second argument to the function ZAXREPLACE.
yes? let trans_pres_adj = transpose_xz(pres_adjusted)
What z axis do we want to use?  You mentioned an axis from ocean-atlas datasets.  We can open up an ocean atlas dataset, and use its Z axis.
yes? use "http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/nodc.woa98/temperat/annual/otemp.anal1deg.nc"
           *** NOTE: Axis coordinates are decreasing-ordered. Reversing ordering for axis lat
yes? show grid otemp
    GRID GNH1
 name       axis         # pts   start           end            subset
 LON       LONGITUDE     360mr   0.5E            0.5W           full
 LAT       LATITUDE      180 r   89.5S           89.5N          full
 LEVEL     DEPTH (m)      33 i-  0               5500           full
 TIME      TIME            1mr   01-JAN 00:00    01-JAN 00:00   full
 normal    E
 normal    F
Define a variable zz which is the z-depths from the variable OTEMP, and define the z-axis regridding.
yes? let zz = z[gz=OTEMP[d=2]]

yes? set data 1
yes? let temp_on_z =  ZAXREPLACE(trans_temp, trans_pres_adj , zz)
Now clean up some details. The function TRANSPOSE_XZ returns the result on an ABSTRACT x axis, and so that is also the x axis of the result from ZAXREPLACE.  We'll define a new axis, just exactly the length of the incoming N_PROF axis.

yes? show grid temp_on_z
    GRID (G010)
 name       axis           # pts   start  end       subset
 ABSTRACT  X          99999999 r   1      1.E+08    (axis from grid-changing func)
 normal    Y
 LEVEL     DEPTH (m)        33 i-  0      5500      full
 normal    T
 normal    E
 normal    F
yes? let nprof = `temp,return=ksize`
 !-> DEFINE VARIABLE nprof = 4
yes? define axis/x=1:`nprof`:1 profile_number
 !-> define axis/x=1:4:1 profile_number
Put the result on this axis, so its grid is number-of-profiles and pressure.
yes? let temp_prof_z = temp_on_z[gx=profile_number@asn]
yes? show grid temp_prof_z
We'd also like to keep the original attributes, such as the title and units, from the file variable TEMP
yes? set att/like=temp temp_prof_z
yes? shade/z=0:1200 temp_prof_z

There are some other details there which Ferret can work with - notice that there are LONGITUDE, LATITUDE and JULD variables which contain a location and time for each profile.  Those could be used in Ferret scripts as well. 

Also, notice that at the end of the list of variables in the "SHOW DATA" output, there are grids that look like this:

 HISTORY_INSTITUTION
          Institution which performed act  1:0       ...       1:4       ...       ...       ...


It turns out that these files have a "record axis" dimension whose length is zero.  There is no data in the files associated with these variables, and so Ferret should just note that and not list these among the dataset variables.

-Ansley


On 2/13/2016 10:03 PM, Venu wrote:
Hi,

Please let me know how can I make the Argo profile of irregular depth intervals into standard depths like in world ocean atlas data to compare with the same. The sample profile is attached. 


Thanks & Regards....!!

Venu
-----------

Mobile:+91-8712404538
           +91-9573547538


"Now or Never...."


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

Privacy Policy | Disclaimer | Accessibility Statement