[Thread Prev][Thread Next][Index]

Re: [ferret_users] Problem in creating time axis using days1900



Hi,
Here's another way to go about it. You don't have to give date strings in the DEFINE AXIS/T command.  You can just give coordinate values in days=0 through 4320.
yes? define axis/t=0:4320:1/unit=day/t0=1-jan-1900 tday

yes? sh axis tday
 name       axis              # pts   start                end
 TDAY      TIME              4321 r   01-JAN-1900 00:00    31-OCT-1911 00:00
T0 = 1-JAN-1900
   Axis span (to cell edges) = 4321

Or, to use the DAYS1900TOYMDHMS function in a script, you could do this:
let end_date = days1900toymdhms(4320  )

let end_year  = end_date[k=1]
let end_month = end_date[k=2]
let end_day   = end_date[k=3]

let months = {"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"}
let mnt = months[i=`end_month`]
define axis/t=1-jan-1900:`end_day`-`mnt`-`end_year`:1/unit=day tday
-Ansley

On 6/7/2013 5:13 AM, samir pokhrel wrote:
Dear Ferret users,

  As I have sort out this issue with the help of Sudheer, but still it requires further refinement, I require further input.

This is with reference to the following FAQ, in which abstract value in I axis is converted into time axis


As there is no proper declaration of variable hour, minute in this FAQ so it is not working.

My script for the same problem goes like this

!----------------------------------------------------------------------------------
!Suppose we have 4320 abstract value in I-axis
!First get the end time kepping 1-jan-1900 as a start time

let end_date = days1900toymdhms(4320)

!-------------Its output is as follows-----------
!yes? list days1900toymdhms(4320)
!             VARIABLE : DAYS1900TOYMDHMS(4320)
!             SUBSET   : 6 points (Z)
! 1   / 1:  1911.
! 2   / 2:    10.
! 3   / 3:    31.
! 4   / 4:     0.
! 5   / 5:     0.
! 6   / 6:     0.
!-----------------------------------------------

let end_year  = end_date[k=1]
let end_month = end_date[k=2]
let end_day   = end_date[k=3]

!Since ferret takes month in string, so converting it

let mnt = if `end_month` eq 10 then "oct"

define axis/t=1-jan-1900:`end_day`-`mnt`-`end_year`:1/unit=day tday

LET dummy = t[GT=tday]

! Using Reshape to convert from abstract I axis to the new T axis

let new_val = RESHAPE(val,dummy)

!--------------------------------------------------------------------------

Still I have following question

Can we directly get the output of days1900toymdhms function in ferret accepted time string (e.g. 31-oct-1911)

Thanking you in advance

Samir



On Fri, Jun 7, 2013 at 5:02 PM, samir pokhrel <pokhrelsamir@xxxxxxxxx> wrote:
Thats great sudheer,

Hope function "days1900toymdhmsthis will solve my problem. 

many thanks

Samir

On Fri, Jun 7, 2013 at 4:50 PM, Sudheer Joseph <sjo.india@xxxxxxxxx> wrote:
Hope below will help you
sjo@sjo-ltp../.sjo_shells~$ f
     NOAA/PMEL TMAP
     FERRET v6.84 
     Linux 2.6.32-279.14.1.el6.x86_64 64-bit - 12/18/12
      7-Jun-13 16:46    

yes? list days1900(2003,01,01)
             VARIABLE : DAYS1900(2003,01,01)
          37620.
yes? list days1900(2003,01,01)
             VARIABLE : DAYS1900(2003,01,01)
          37620.
yes? list 37620 +4320
             VARIABLE : 37620 +4320
          41940.
yes? LIST days1900toymdhms(41940)
             VARIABLE : DAYS1900TOYMDHMS(41940)
             SUBSET   : 6 points (Z)
 1   / 1:  2014.
 2   / 2:    10.
 3   / 3:    30.
 4   / 4:     0.
 5   / 5:     0.
 6   / 6:     0.
yes? LIST days1900toymdhms(41940)



On Fri, Jun 7, 2013 at 4:38 PM, samir pokhrel <pokhrelsamir@xxxxxxxxx> wrote:
Thats fine Sudheer,

But my point is if you have suppose 4320 abstract values in x-axis which you have to eventually put in the time axis

Since it is abstract you don't have start time and end time with it (so you cannot use define axis command here with specific start and end date), so the first step will be define a dummy start point let it be 1-jan-1900, now my question is without calculating manually how you can know what is the end point using days1900 function. The same thing they have shown in the FAQ.

I hope I am able to explain you my query?

Thanks for sparing your time

Samir


On Fri, Jun 7, 2013 at 4:19 PM, Sudheer Joseph <sjo.india@xxxxxxxxx> wrote:
It is simple Samir,
                                  If you need a time axis starting say at 01-01-2001 and ending at 31-12-2012
def axis/t=01-01-2001:31-12-2012:1/units =days tax

let grid= t[gt=tax]
or if you have another axis say longitude
def axis/x=30:100:1/units=degrees_east xax
let ngrd=x[gx=xax]+t[gt=tax]
let new_var=reshape(old_var,ngrd)
hope this helps
Sudheer


On Fri, Jun 7, 2013 at 4:01 PM, samir pokhrel <pokhrelsamir@xxxxxxxxx> wrote:
Sudheer,

Can you just have a look on this FAQ


Is there something wrong, How come they are assigning 4320 points to time axis.
Or there is some catch, which I am not able to get.


comment

regards
Samir


On Fri, Jun 7, 2013 at 2:35 PM, samir pokhrel <pokhrelsamir@xxxxxxxxx> wrote:
Its true sudheer, even I was suspecting how it is taking hour and minute of its own, but as it was mentioned in the faq I thought it may be some internal variable, Actually I have not completely understood the usage of days1900. I wish to convert the variable in x axis to t axis so that I can calculate correlation and other stuff.

thanks samir


On Fri, Jun 7, 2013 at 12:50 PM, Sudheer Joseph <sjo.india@xxxxxxxxx> wrote:
Dear Samir,
                    It need to be  provided if you want to use it.  I am not sure why you keep the day fraction there?
you need a time axis starting from a day and ending in another day so you can straight away define those I feel unless you have some requirement which I did not follow.
with best regards,
Sudheer


On Fri, Jun 7, 2013 at 12:39 PM, samir pokhrel <pokhrelsamir@xxxxxxxxx> wrote:
Dear Sudhir,

No I don't get anything 
when I list minute, hour and even day

Samir

On Fri, Jun 7, 2013 at 12:13 PM, Sudheer Joseph <sjo.india@xxxxxxxxx> wrote:
Hi Samir,
                  Ferret is not able to see definition of minutes from your script which is the root cause of all errors.
if you type yes? list minutes are you able to see the numbers?


On Fri, Jun 7, 2013 at 11:50 AM, samir pokhrel <pokhrelsamir@xxxxxxxxx> wrote:
Dear Ferret users,

I am trying to convert abstract data (which is in x axis) in time axis using days1900 using ferret v6.303 (AIX version)

I have got 31185 steps. I have gone through the FAQ and adopted the following procedure

!------------------------------------------------------------
LET day_frac = (hour + minute/60 ) / 24
LET tstep = DAYS1900(year,month,day) + day_frac

DEFINE axis/T/T0=1-jan-1900/UNIT=days ttaxis=tstep[L=1:31185]

LET dummy=t[GT=ttaxis]
LET p = RESHAPE(p1,dummy)
!--------------------------------------------------------------

However it is giving following error

**ERROR: variable unknown or not in data set: MINUTE
**ERROR: unknown defining grid: GT=TTAXIS

I tried to do it in several ways but the error remains the same.

Hope to get help from users who have solve this type of issue earlier.

Thanking you in advance.

Samir
--
Samir Pokhrel
Climate and Global Modelling Division
Indian Institute of Tropical Meteorologyv6.303
NCL Post, Pashan
Pune-411008
INDIA



--
with best regards

Sudheer

**********************************************************************************
Dr. Sudheer Joseph                                                                
Scientist                                                                         
INDIAN NATIONAL CENTRE FOR OCEAN INFORMATION SERVICES (INCOIS)
MINISTRY OF EARTH SCIENCES, GOVERNMENT OF INDIA
"OCEAN VALLEY" PRAGATHI NAGAR (BO)
OPP.JNTU, NIZAMPET SO
Andhra Pradesh, India. PIN- 500 090.
TEl:+91-40-23044600(R),Tel:+91-9440832534(Mobile)
Tel:+91-40-23886047(O),Fax:+91-40-23892910(O)
E-mail: sudheer.joseph@xxxxxxxxx;  sjo@xxxxxxxxxxxxx.
Web- http://oppamthadathil.tripod.com
           --------------* ---------------
"The ultimate measure of a man is
not where he stands in moments of
comfort and convenience, but where
he stands at times of challenge and
controversy."
                        Martin Luther King, Jr.
"What we have done for ourselves alone dies with us.
What we have done for others and the world remains and is immortal."
- Albert Pines



--
Samir Pokhrel
Climate and Global Modelling Division
Indian Institute of Tropical Meteorology
NCL Post, Pashan
Pune-411008
INDIA



--
with best regards

Sudheer

**********************************************************************************
Dr. Sudheer Joseph                                                                
Scientist                                                                         
INDIAN NATIONAL CENTRE FOR OCEAN INFORMATION SERVICES (INCOIS)
MINISTRY OF EARTH SCIENCES, GOVERNMENT OF INDIA
"OCEAN VALLEY" PRAGATHI NAGAR (BO)
OPP.JNTU, NIZAMPET SO
Andhra Pradesh, India. PIN- 500 090.
TEl:+91-40-23044600(R),Tel:+91-9440832534(Mobile)
Tel:+91-40-23886047(O),Fax:+91-40-23892910(O)
E-mail: sudheer.joseph@xxxxxxxxx;  sjo@xxxxxxxxxxxxx.
Web- http://oppamthadathil.tripod.com
           --------------* ---------------
"The ultimate measure of a man is
not where he stands in moments of
comfort and convenience, but where
he stands at times of challenge and
controversy."
                        Martin Luther King, Jr.
"What we have done for ourselves alone dies with us.
What we have done for others and the world remains and is immortal."
- Albert Pines



--
Samir Pokhrel
Climate and Global Modelling Division
Indian Institute of Tropical Meteorology
NCL Post, Pashan
Pune-411008
INDIA



--
Samir Pokhrel
Climate and Global Modelling Division
Indian Institute of Tropical Meteorology
NCL Post, Pashan
Pune-411008
INDIA



--
with best regards

Sudheer

**********************************************************************************
Dr. Sudheer Joseph                                                                
Scientist                                                                         
INDIAN NATIONAL CENTRE FOR OCEAN INFORMATION SERVICES (INCOIS)
MINISTRY OF EARTH SCIENCES, GOVERNMENT OF INDIA
"OCEAN VALLEY" PRAGATHI NAGAR (BO)
OPP.JNTU, NIZAMPET SO
Andhra Pradesh, India. PIN- 500 090.
TEl:+91-40-23044600(R),Tel:+91-9440832534(Mobile)
Tel:+91-40-23886047(O),Fax:+91-40-23892910(O)
E-mail: sudheer.joseph@xxxxxxxxx;  sjo@xxxxxxxxxxxxx.
Web- http://oppamthadathil.tripod.com
           --------------* ---------------
"The ultimate measure of a man is
not where he stands in moments of
comfort and convenience, but where
he stands at times of challenge and
controversy."
                        Martin Luther King, Jr.
"What we have done for ourselves alone dies with us.
What we have done for others and the world remains and is immortal."
- Albert Pines



--
Samir Pokhrel
Climate and Global Modelling Division
Indian Institute of Tropical Meteorology
NCL Post, Pashan
Pune-411008
INDIA



--
with best regards

Sudheer

**********************************************************************************
Dr. Sudheer Joseph                                                                
Scientist                                                                         
INDIAN NATIONAL CENTRE FOR OCEAN INFORMATION SERVICES (INCOIS)
MINISTRY OF EARTH SCIENCES, GOVERNMENT OF INDIA
"OCEAN VALLEY" PRAGATHI NAGAR (BO)
OPP.JNTU, NIZAMPET SO
Andhra Pradesh, India. PIN- 500 090.
TEl:+91-40-23044600(R),Tel:+91-9440832534(Mobile)
Tel:+91-40-23886047(O),Fax:+91-40-23892910(O)
E-mail: sudheer.joseph@xxxxxxxxx;  sjo@xxxxxxxxxxxxx.
Web- http://oppamthadathil.tripod.com
           --------------* ---------------
"The ultimate measure of a man is
not where he stands in moments of
comfort and convenience, but where
he stands at times of challenge and
controversy."
                        Martin Luther King, Jr.
"What we have done for ourselves alone dies with us.
What we have done for others and the world remains and is immortal."
- Albert Pines



--
Samir Pokhrel
Climate and Global Modelling Division
Indian Institute of Tropical Meteorology
NCL Post, Pashan
Pune-411008
INDIA



--
Samir Pokhrel
Climate and Global Modelling Division
Indian Institute of Tropical Meteorology
NCL Post, Pashan
Pune-411008
INDIA


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

Privacy Policy | Disclaimer | Accessibility Statement