Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

year 0000, 0001 not listed for time steps, non-modulo axes #362

Closed
karlmsmith opened this issue Nov 22, 2017 · 3 comments
Closed

year 0000, 0001 not listed for time steps, non-modulo axes #362

karlmsmith opened this issue Nov 22, 2017 · 3 comments

Comments

@karlmsmith
Copy link
Contributor

karlmsmith commented Nov 22, 2017

Reported by @AnsleyManke on 15 Jan 2004 17:07 UTC
! Say I have a variable with a time axis that starts
! either in year 0000 or year 0001, e.g.

yes? def ax/t=1-jan-0000:1-jan-0003:1/unit=month tax1
yes? def ax/t=1-jan-0001:1-jan-0003:1/unit=month tax2

! Now in a script, how can one reliably extract the start
! year? In immediate mode, both of these axes return a string
! without a year:

yes? say t[gt=tax1],r=tstart
01-JAN 00:00
yes? say t[gt=tax2],r=tstart
01-JAN 00:00

yes? show grid/t t[gt=tax1]
GRID (G002)
name axis # pts start end
normal X
normal Y
normal Z
TAX1 TIME 38 r 01-JAN 00:00 31-JAN-0003 03:56

   L     T                   TBOX      TBOXLO                TSTEP (MONTH)
   1>  01-JAN      00:00:00  1         01-JAN     :00:00:00   0
   2>  31-JAN      10:29:06  1         16-JAN      05:14:33   1
   3>  01-MAR      20:58:12  1         15-FEB      15:43:39   2
   4>  01-APR      07:27:18  1         17-MAR      02:12:45   3
   5>  01-MAY      17:56:24  1         16-APR      12:41:51   4
   6>  01-JUN      04:25:30  1         16-MAY      23:10:57   5
   7>  01-JUL      14:54:36  1         16-JUN      09:40:03   6
   8>  01-AUG      01:23:42  1         16-JUL      20:09:09   7
   9>  31-AUG      11:52:48  1         16-AUG      06:38:15   8
  10>  30-SEP      22:21:54  1         15-SEP      17:07:21   9
  11>  31-OCT      08:51:00  1         16-OCT      03:36:27   10
  12>  30-NOV      19:20:06  1         15-NOV      14:05:33   11
  13>  31-DEC      05:49:12  1         16-DEC      00:34:39   12
  14>  30-JAN      16:18:18  1         15-JAN      11:03:45   13
  15>  02-MAR      02:47:24  1         14-FEB      21:32:51   14
  16>  01-APR      13:16:30  1         17-MAR      08:01:57   15
  17>  01-MAY      23:45:36  1         16-APR      18:31:03   16
  18>  01-JUN      10:14:42  1         17-MAY      05:00:09   17
  19>  01-JUL      20:43:48  1         16-JUN      15:29:15   18
  20>  01-AUG      07:12:54  1         17-JUL      01:58:21   19
  21>  31-AUG      17:42:00  1         16-AUG      12:27:27   20
  22>  01-OCT      04:11:06  1         15-SEP      22:56:33   21
  23>  31-OCT      14:40:12  1         16-OCT      09:25:39   22
  24>  01-DEC      01:09:18  1         15-NOV      19:54:45   23
  25>  31-DEC      11:38:24  1         16-DEC      06:23:51   24
  26>  30-JAN-0002 22:07:30  1         15-JAN-0002 16:52:57   25
  27>  02-MAR-0002 08:36:36  1         15-FEB-0002 03:22:03   26
  28>  01-APR-0002 19:05:42  1         17-MAR-0002 13:51:09   27
  29>  02-MAY-0002 05:34:48  1         17-APR-0002 00:20:15   28
  30>  01-JUN-0002 16:03:54  1         17-MAY-0002 10:49:21   29
  31>  02-JUL-0002 02:33:00  1         16-JUN-0002 21:18:27   30
  32>  01-AUG-0002 13:02:06  1         17-JUL-0002 07:47:33   31
  33>  31-AUG-0002 23:31:12  1         16-AUG-0002 18:16:39   32
  34>  01-OCT-0002 10:00:18  1         16-SEP-0002 04:45:45   33
  35>  31-OCT-0002 20:29:24  1         16-OCT-0002 15:14:51   34
  36>  01-DEC-0002 06:58:30  1         16-NOV-0002 01:43:57   35
  37>  31-DEC-0002 17:27:36  1         16-DEC-0002 12:13:03   36
  38>  31-JAN-0003 03:56:42  1         15-JAN-0003 22:42:09   37

translate_to_world, calls secs_to_date. This ALWAYS replaces
year 0000 or 0001 in the date string with blanks.

Possible fix:
translate_to_world knows if the time axis in question is modulo.
If it's non-modulo, then keep the year string?

Migrated-From: http://dunkel.pmel.noaa.gov/trac/ferret/ticket/762

@karlmsmith
Copy link
Contributor Author

karlmsmith commented Nov 22, 2017

Comment by @AnsleyManke on 4 Mar 2008 18:33 UTC
This is fixed, so that we write the year unless

  1. the axis is a modulo axis, and
  2. the year is 0001 or 0002

In the future it would be better to also test for whether the axis is of length
1 year or less and surpress the year only if it's shorter than a year.
Translating the axis length to units of a year and making this comparison was
more than we wanted to take time for now.

Here is the current behavior:

yes? define axis/t=15-jan-0000:15-dec-0000:2/modulo/units=month tax
*** NOTE: /UNIT=MONTHS is ambiguous ... using 1/12 of 365.2425 days
Replacing definition of axis TAX
yes? list t[gt=tax]
VARIABLE : T
axis TAX
SUBSET : 7 points (TIME)
15-JAN / 1: 0.46
15-MAR / 2: 2.46
15-MAY / 3: 4.46
15-JUL / 4: 6.46
14-SEP / 5: 8.46
14-NOV / 6: 10.46
14-JAN / 7: 12.46

yes? define axis/t=15-jan-0000:15-dec-0004:6/units=month tax
*** NOTE: /UNIT=MONTHS is ambiguous ... using 1/12 of 365.2425 days
Replacing definition of axis TAX
yes? list t[gt=tax]
VARIABLE : T
axis TAX
SUBSET : 11 points (TIME)
15-JAN-0000 / 1: 0.46
15-JUL-0000 / 2: 6.46
14-JAN-0001 / 3: 12.46
15-JUL-0001 / 4: 18.46
14-JAN-0002 / 5: 24.46
16-JUL-0002 / 6: 30.46
14-JAN-0003 / 7: 36.46
16-JUL-0003 / 8: 42.46
14-JAN-0004 / 9: 48.46
15-JUL-0004 / 10: 54.46
14-JAN-0005 / 11: 60.46

@karlmsmith
Copy link
Contributor Author

karlmsmith commented Nov 22, 2017

Comment by @AnsleyManke on 4 Mar 2008 18:42 UTC
The above should have read, This is fixed, so that we write the year unless

  1. the axis is a modulo axis, and
  2. the year is 0000 or 0001

@karlmsmith
Copy link
Contributor Author

karlmsmith commented Nov 22, 2017

Comment by @AndrewWittenberg on 16 Nov 2009 22:37 UTC
This is fixed as of v6.31beta (dated 11/5/09).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant