Hi Ansley,
Thanks for your prompt and detailed explanation.
I attached journal and figure files. In the figures the variable "pres" on left panel clearly shows that it has different depth values for the same level: in the figure, I added a circle mark for that.
I also found that pres in most of argo float data is time-varing.
So, I would be appreciated if you can provide the ZAXREPLACE function that can handle time-varing z-axis.
Chan Joo
--------------------------------------- [ Original Message ] --------------------------------------
Sender : Ansley Manke < Ansley.B.Manke@xxxxxxxx >
To : Chan Joo Jang < cjjang@xxxxxxxxxxx >
CC : oar.pmel.ferret_users@xxxxxxxx
Date : 2007-12-18 03:21:34
S u b j e c t : Re: [want real z-axis]Re: [ferret_users] change axis
Hi,
There is a family of Ferret functions, ZAXREPLACE*, which I show here:
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
ZAXREPLACE_AVG(V,ZVALS,ZAX)
regrid V onto Z axis of ZAX based on Z values in ZVALS using weighted average
V: Variable on native z axis
ZVALS: Destination Z axis values as a fcn of source Z axis
ZAX: Variable with desired z (depth) axis points
...
These allow you to define a Z axis and a relation of the new Z axis to the existing one, in this case relating pressure to Z level. These functions do not allow the function relating the pressure and level values to vary in time (except for the ZAXREPLACE_ZLEVS function, which does not apply here). We could easily write a new function that would let the pressure values vary in time.
The particular file you sent however, looks as though the pressures do not change in time. They certainly could vary, in profile data like this, but to show how the function can be applied, let's just proceed. Also there seems to be something odd going on in the middle of the record, as though values from mid-depth have been shifted. I'll ignore this for now as well.
Apply the same transformations to PRES that we did with TEMP. After running the commands from the last message,
yes? LET/UNITS="`pres,RETURN=units`"/TITLE="`pres,RETURN=title`" \Please try all of this and see whether you run into cases where the pressure values do change in time. If they do, we could set up a new external function based on ZAXREPLACE where the second argument varies in time. The function would just loop over time, recomputing the level-to-pressure transformation at each time.
pressure = pres[GZ=zlev@ASN, GT=tday@ASN]
yes? shade pressure ! see how the pressure values are constant in time
! Define an output Z axis with units of pressure, based on the data at the first time step.
yes? define axis/z/units=decibars/title=pressure/depth zpres = presure[L=1]
! Call zaxreplace to put the temperature data on this new pressure axis,
yes? let/units="`temperature,return=units`"/title="`temperature,return=title`" \
temp_on_pres = zaxreplace (temperature, z[gz=zpres], z[gz=zpres])
yes? shade temperature
Chan Joo Jang wrote:Thanks Ansley,
My problem is now nearly solved based on your guidance, with some more refinements for z axis.
In fact, for z axis, I would like to have pressure unit, instead of level unit.
In the example nc file, there is a variable called pres that is actual depth in decibar.
The problem is that pres varies on time (N_PROF), as well as on level (N_LEVELS) as follows:
yes? use/order=ZT 2900623_prof.nc
yes? sh grid pres
GRID GJV4
name axis # pts start end
normal X
normal Y
N_LEVELS Z 48 r 1 48
N_PROF T 35 r 1 35
How can I have temp on z-axis with actuall pressure unit, instead of level unit.
Thanks in advance,
Chan Joo
--------------------------------------- [ Original Message ] --------------------------------------
Sender : Ansley Manke < Ansley.B.Manke@xxxxxxxx >
To : Chan Joo Jang < cjjang@xxxxxxxxxxx >
CC : oar.pmel.ferret_users@xxxxxxxx
Date : 2007-12-15 08:27:10
S u b j e c t : Re: [ferret_users] change axis
Hi,
Thanks for the example file. Ferret has some tools to deal with this kind of profile data. As you found, if we just point to the data, it's on a grid that doesn't make sense:
yes? USE argo2900623_prof.ncThe attributes in the file don't give Ferret enough information to know that N_LEVELS should be a Z axis and N_PROF should be a T axis. We can use the /ORDER qualifier to force the correct directions to be used:
yes? SHOW GRID temp
GRID GAI4
name axis # pts start end
N_LEVELS X 48 r 1 48
N_PROF Y 35 r 1 35
normal Z
normal T
yes? CANCEL DATA/ALLNow, we'd like to use the variable JULD to define a time axis. In files like this, sometimes the times are not in monotonically increasing order, and so we would need to sort them. I'll come back to this. In this file, the times are monotonically increasing, so we can just use them as is.
yes? USE/ORDER=ZT
yes? SHOW GRID temp
GRID GAI4
name axis # pts start end
normal X
normal Y
N_LEVELS Z 48 r 1 48
N_PROF T 35 r 1 35
! this gives us the units and time origin.
yes? LIST juld.units
"days since 1950-01-01 00:00:00 UTC"
! Define a time axis based on JULD
yes? DEFINE AXIS/T/T0="1-jan-1950:00:00"/UNITS=days tday = juld
! Also define a new Z axis. This is ocean data, so it should
! be increasing downwards. First define zz, a variable containing
! the levels, then define an axis from that variable.
yes? LET zz = z[gz=temp]
yes? DEFINE AXIS/Z/UNITS=levels/DEPTH zlev = zz
! Now define a new variable on these corrected axes,
! using the @ASN transformation to just put them onto
! the new axes. Keep the units and title from TEMP.
yes? LET/UNITS="`temp,RETURN=units`"/\
TITLE="`temp,RETURN=title`" \
temperature = temp[GZ=zlev@ASN, GT=tday@ASN]! Now the variable is on the correct ZT grid,If the JULD variable were not monotonic, we would need to SORT the variable JULD, and use the result to both define the new time axis and also to reorder TEMP in T before assigning it to the new T axis.
! For example, we can do these things:
yes? plot/L=1 temperature
yes? shade temperature
Ansley
Chan Joo Jang wrote:Hi Ferr users,
I got ARGO float data files from http://www.usgodae.org/cgi-bin/argo_select.pl .
(One of those nc files is attached for your reference.)
Using some functions such as RESHAPE, I tried to change original axis (n_prof, n_levels) to (time, depth) of TEMP (temperature), without any success.
In other words, I want to have TEMP(julian day, pres) instead of TEMP(n_prof, n_levels). All informations for julian day(juld) and depth (pres) are in the nc files.
Any ideas or suggestions would be welcome.
oceanboy
=======
PS) Some parts of ncdump output are as follows:
netcdf 2900623_prof {
dimensions:
DATE_TIME = 14 ;
STRING256 = 256 ;
STRING64 = 64 ;
STRING32 = 32 ;
STRING16 = 16 ;
STRING8 = 8 ;
STRING4 = 4 ;
STRING2 = 2 ;
N_PROF = 35 ;
N_PARAM = 3 ;
N_LEVELS = 48 ;
N_CALIB = 1 ;
N_HISTORY = UNLIMITED ; // (0 currently)
variables:
float PRES(N_PROF, N_LEVELS) ;
PRES:long_name = "SEA PRESSURE" ;
PRES:_FillValue = 99999.f ;
PRES:units = "decibar" ;
PRES:valid_min = 0.f ;
PRES:valid_max = 12000.f ;
PRES:comment = "In situ measurement, sea surface = 0" ;
PRES:C_format = "%7.1f" ;
PRES:FORTRAN_format = "F7.1" ;
PRES:resolution = 0.1f ;
float TEMP(N_PROF, N_LEVELS) ;
TEMP:long_name = "SEA TEMPERATURE IN SITU ITS-90 SCALE" ;
TEMP:_FillValue = 99999.f ;
TEMP:units = "degree_Celsius" ;
TEMP:valid_min = -2.f ;
TEMP:valid_max = 40.f ;
TEMP:comment = "In situ measurement" ;
TEMP:C_format = "%9.3f" ;
TEMP:FORTRAN_format = "F9.3" ;
TEMP:resolution = 0.001f ;
------------------------------------------------
Currently at Dep. of Oceanography, Texas A&M Univ
Chan Joo Jang, Ph.D., researcher
Korea Ocean Research and Development Institute
1270 Sa2-dong, SangRok-gu, Ansan 426-744, Korea
Tel: +82-31-400-6317 Fax: +82-31-408-5827
cjjang@xxxxxxxxxxx, http://ogcm.kordi.re.kr
------------------------------------------------
------------------------------------------------
Currently at Dep. of Oceanography, Texas A&M Univ
Chan Joo Jang, Ph.D., researcher
Korea Ocean Research and Development Institute
1270 Sa2-dong, SangRok-gu, Ansan 426-744, Korea
Tel: +82-31-400-6317 Fax: +82-31-408-5827
cjjang@xxxxxxxxxxx, http://ogcm.kordi.re.kr
------------------------------------------------
Attachment:
changeZaxis.jnl
Description: Binary data
Attachment:
argo2900623_prof_mark.jpg
Description: JPEG image