[Thread Prev][Thread Next][Index]

Re: [ferret_users] How to set yaxis to be depth and not numberof layers



Hi,

It depends a bit on what is in the file.

When an axis has the right coordinate values in the file, but does not have the attributes that let Ferret know the units of the axis, then you can use SET AXIS to add that information.  So if the axis in your dataset already has the right day numbers, day 126 to 273, then that would look something like this, and the variables will plot with labeled dates:

    set axis/units=days/t0=1-jan-2005 `temp,return=taxis`

If the axis is just steps, 1,2,3,... ,  then you would define the correct axis, and use @ASN regridding to put the variables onto that axis.  Your definition needs the /T0 qualifier to define the time origin.  (You do not need /NPOINTS if you are using   /L=lo:hi).

define axis/t0= /units=
let temp_on_time = temp[gt=day_axis@ASN]

Ansley


On 10/11/2016 9:18 AM, 'Sara Sari' via _OAR PMEL Ferret Users wrote:
Thank you Ansely,
I could convert my yaxis to depths by using this script:

DEFINE AXIS/z=1:20:1/unit=m/depth zdepth
LET tempdepth=zaxreplace(temp,(-1)*zout,z[gz=zdepth]
 shade/j=20/i=65/levels=(1,30,1) tempdepth

now I want to  convert my time axis(xaxis) to date like May-Sep /or setting it so that it shows the day number of the year. I tried this code:

define axis/l=126:273/npoint=148/units=days  day_axis

yes? sh axis day_axis
 name       axis              # pts   start                end
 DAY_AXIS  T (DAYS)           148 r   126                  273
   Axis span (to cell edges) = 148

now I don't know the rest of script so that I can plot tempdepth on this axis.
I have attached what my plot looks like.
and what I want is to set the time axis to daynumber /or real date.
Could you please give me the script for that?
Thank you.
I also put the show data command to see how my data are:

yes? sh d
     currently SET data sets:
    1> ./rhoneG_1.tsout3N  (default)
 name     title                                                         I            J         K         L         M         N
 XOUT     X-coordinate                                1:193     1:87      ...            ...       ...       ...
 YOUT     Y-coordinate                                1:193     1:87      ...            ...       ...       ...
 ZOUT     Z-coordinate                                 1:193     1:87    1:25         ...       ...       ...
 DEPOUT   Mean_water_depth                 1:193     1:87      ...            ...       ...       ...
 TIME     Time                                                      ...       ...         ...            1:148     ...       ...
 UVEL     X-component_of_current            1:193     1:87      1:25      1:148     ...       ...
 VVEL     Y-component_of_current            1:193     1:87      1:25      1:148     ...       ...
 TEMP     Temperature                                 1:193     1:87      1:25      1:148     ...       ...
 
as you can see I have 148 time steps(daily output), which starts from May 5th to Sep 30/2005.
I want to set my time axis so that I can have 126 (daynumber of May6th) to 273 (which is the daynumber of Sep30th/2005).


On Tuesday, October 4, 2016 5:54 PM, Ansley C. Manke <ansley.b.manke@xxxxxxxx> wrote:


Hi,
The syntax temp[gz(sigma) = depthaxis]  is an example only. It is showing how to use there is a variable in the file, or a variable that the user has defined, called sigma, that is used to make the conversion from layer to depth or height. 
It looks as if the variable that defines the relation between depth and layer is ZOUT.   Look at the output of the commands,
   yes? show attributes zout
   yes? show attributes temp
Does temp have a coordinates attribute?  If so does it list zout as a coordinate variable?  zout has a title (the long_name attribute) of Z-coordinate.  Are its units given in meters?  Are there other attributes on zout that give you an idea about its role in the dataset?


On 10/4/2016 12:57 PM, Sara Sari wrote:
Thank you Ansley, but the script that you gave me produced no plot And I got a white and empty plot.
Here are my show data info:


     currently SET data sets:
    1> ./rhoneG_1.tsout3N  (default)
 name     title                                                      I         J         K             L         M         N
 XOUT     longitude                                      1:193     1:87      ...          ...       ...       ...
 YOUT     latitude                                          1:193     1:87      ...           ...       ...       ...
 ZOUT     Z-coordinate                                 1:193     1:87      1:25      ...       ...       ...
 DEPOUT   Mean_water_depth                 1:193     1:87      ...          ...       ...       ...
 TIME     Time                                                     ...       ...       ...               1:59      ...       ...
 UVEL     X-component_of_current             1:193     1:87      1:25      1:59      ...       ...
 VVEL     Y-component_of_current             1:193     1:87      1:25      1:59      ...       ...
 TEMP     Temperature                                  1:193     1:87      1:25      1:59      ...       ...
 
I entered:

yes? define axis/z=0:65:5/units=m depthaxis
yes? let/units="Degree C" temp_z = temp[gz(sigma) = depthaxis]

as my max depth is 64m.


I also tried this:

define axis/z/from/units=m/depth my_z_axis=zout
 **ERROR: improper grid or axis definition: data for DEFINE AXIS/FROM_VARIABLE is ambiguous
but don't know what this error means and how I can fix it?
Regards
Sara


On Monday, October 3, 2016 6:28 PM, Ansley C. Manke <ansley.b.manke@xxxxxxxx> wrote:


Hi
Ferret gets that information from the dataset. For many model outputs, there is a separate variable in the dataset that defines the depth as a function of layer.  There are older functions in Ferret that will do this operation, but the best way is the "Auxiliary Variable Regridding" operation, available in Ferret v6.96 and higher. See:
The examples in the Ferret manual define a sigma function using variables in the file.  I am guessing that you may be using a file that already contains a variable that defines the conversion between layers and depth.  It may be named something else of course.  Look for the "coordinates" attribute in the dataset.
If your variable  is "temp", then part of the ncdump output of the file might look like this:
float temp(zlev,lat,lon);
  temp:units="Degree C";
  temp:coordinates="model_level";
float sigma(zlev); 
  sigma:long_name="sigma";
  sigma:positive="down";
  sigma:units="m";
int model_level(zlev); 
  model_level:long_name="model level number";
  model_level:positive="down";
The variable "temp", and the coordinate variables "sigma" and "model_level" all have the same z dimension "zlev".  The native grid of temp  is on the model-level axis, just level # 1, 2, 3...  To get a variable on a depth axis, the data in "sigma" can be used to convert between the two.

So, you would define any depth axis, with the same units as "sigma".   Define your depth axis to have depths with the range of depth values that appear in the sigma coordinate variable in your dataset.
yes? define axis/z=0:5000:10/units=m depthaxis
yes? let/units="Degree C" temp_z = temp[gz(sigma) = depthaxis]
Now you can make a plot of the variable "temp_z" and it will be on a depth axis.

-Ansley

On 10/3/2016 10:08 AM, 'sarasari206@xxxxxxxxx' via _OAR PMEL Ferret Users wrote:
Hello Ferret Users,
I want to plot a transect of temp with  region of x=193 by y=87 points which has 25 layes in depth. But I dont want to have layers in my yaxis when plotting. I want to have depth instead of number of layers. Could you please tell me What the script  is for that?
Thanks








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

Privacy Policy | Disclaimer | Accessibility Statement