[Thread Prev][Thread Next][Index]

Re: 2D shaded time series plot



Steve,
Is the total dimension of the data in temp.cdf the same as the 12x2
dimensions of the grid you define?  That is, does tmax have 24 points? 
or perhaps does it start with some missing values, which are getting mapped
onto the new grid?

RESHAPE takes the entire variable tmax (unless you specify a subset of
it in the call to RESHAPE) and unravels it in standard Fortran order,
then wraps that list of data values onto the output grid.

Ansley

Steve Knox wrote:
Has any one out there used the "reshape" function?

I seem to be  still missing something re the "reshape" function.
Here's what I'm doing but I get and empty dataset returned, although I expect some data.


use temp.cdf    

DEFINE AXIS/T=1951:1952:1 tyear
DEFINE AXIS/Z=1:12:1 zmonth
LET out_grid = Z[GZ=zmonth]+T[GT=tyear]
LET my_reshaped = RESHAPE(tmax, out_grid)
SHOW GRID my_reshaped
    GRID (G002)
 name       axis              # pts   start                end
 normal    X
 normal    Y                      
 ZMONTH    Z                   12 r   1                    12
 TYEAR     T                    2 r   1951                 1952
(the grid seems ok by when I try to list the data, I get an empty set)
list my_reshaped
             VARIABLE : RESHAPE(TMAX, OUT_GRID)
             FILENAME : temp.cdf
             SUBSET   : 12 by 2 points (Z-T)
              1   2   3   4   5   6   7   8   9   10  11  12 
               1   2   3   4   5   6   7   8   9  10  11  12
 1951   / 1:................................................
 1952   / 2:................................................

Thanks,



Ansley Manke wrote:
Steve,
The message you're seeing is just a warning that "MONTHS" is an ambiguous
unit; it depends on the length of the year (models might use even-spaced, 30-
day months, or you might have in mind unequally-spaced months based on the
actual number of days in each calendar month).  This warning is to make sure
you're aware of this.

It looks like the axis tcal you've created doesn't quite match the range of your
data -- your data starts in 1901 if its time origin is in January of  1900 and the
first time step is 12.  In fact, I don't think there's any reason  to regrid your time
series at all.  The example in the Users Guide is just creating an example time
series to use. If you just create the T (year) and Z (month) axes to correspond to
the length of your time series and do the RESHAPE I think it'll work fine.

Ansley


Steve Knox wrote:
Thanks for pointing me to the reshape command.
I seem to be doing something wrong, however, when I try to follow the example.
 Why do I get an error from UNITS=MON. (If I omit "UNITS=MON" I get no warning message but the results are the same).
The reshaped grid seems ok but when I list my_reshaped I get no data.

The time variable in my file tmp.cdf is :       
                float time(time) ;
                time:units = "months since 1900-01-15 00:00:00" ;
                time:title = "Time" ;
                time:long_name = "Time axis" ;
                time:time_origin = " 1900-01-15 00:00:00" ;
The variable time has values:
 time = 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
...
...
When I follow the example this is what I get:

use tmp.cdf
DEFINE AXIS/t=1-JAN-1900:31-DEC-1903/NPOINTS=48/UNITS=MON tcal
 *** NOTE: /UNIT=MONTHS is ambiguous ... using 1/12 of 365.2425 days
Replacing definition of axis TCAL
LET my_time_series = tmp[gt=tcal]  ! tmp is my average temp variable
DEFINE AXIS/t=1900:1903:1 tyear
DEFINE AXIS/Z=1:12:1 zmonth
LET out_grid = Z[GZ=zmonth]+T[GT=tyear]
LET my_reshaped = RESHAPE(my_time_series, out_grid)
SHOW GRID my_reshaped
    GRID (G002)
 name       axis              # pts   start                end
 normal    X
 normal    Y
 ZMONTH    Z                   12 r   1                    12
 TYEAR     T                    4 r   1900                 1903
list my_reshaped
             VARIABLE : RESHAPE(MY_TIME_SERIES, OUT_GRID)
             FILENAME : tmp.cdf
             SUBSET   : 12 by 4 points (Z-T)
              1   2   3   4   5   6   7   8   9   10  11  12 
               1   2   3   4   5   6   7   8   9  10  11  12
 1900   / 1:................................................
 1901   / 2:................................................
 1902   / 3:................................................
 1903   / 4:................................................

Ansley Manke wrote:
Hi Steve,
The question of how to represent data as year vs month-of-year happens
to be explained as an example of the RESHAPE function.  Take a look in
the Users Guide under reshape.

Ansley Manke
 
 

Steve Knox wrote:

 
  I have a netcdf file with 1 variable, tmp  for latitudes -90 to 90 (by 1/2 deg) and longitudes -180 to 180 (by 1/2 degree)
The time unit is "months since 1900-01-15 00:00:00". There are 1200 months (100 years).
I would like to plot year along the x-axis and month (1-12) on the y-axis for a paricular spatial aggregation.
The "value" plotted should be a shaded area, representing the value at each month. I want to look for monthly
or seasonal variations over time.

12  B     A


 
 
 
 
 
 ...
 3   A
 2   B    A
 1   B    B


    1901     1902    ...

Where the letters" images would actually be shaded areas.

Is this possible with Ferret?

yes? use tmp
yes? show data
     currently SET data sets:
    1> ./tmp.cdf  (default)
 name     title                             I         J         K         L
 TMP      Surface air temperature          1:720     1:360     ...       1:1200
 

-- 
_________________________
Steve Knox
NREL
Colorado State University
(970)491-1972

-- 
_________________________
Steve Knox
NREL
Colorado State University
(970)491-1972
  


-- 
_________________________
Steve Knox
NREL
Colorado State University
(970)491-1972
  


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement