[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #CYH-100629]: getStartTime() equivalent for Gridded datasets



Hi Valentijn-

> Full Name: Valentijn Venus
> Email Address: address@hidden
> Organization: ITC
> Package Version: 2.6a3 build date:2008-08-05 07:05 UTC
> Operating System: Windows XP
> Hardware: Java: home: C:\Program Files\Java\jre1.6.0_06 version: 1.6.0_06 
> j3d:1.3.2 fcs (build12)
> Description of problem: Hi-
> 
> For ADDE images i was using the following Jython procedure to find the
> julian day numbers for each singleBanded image in a imageSeq.
> 
> Now i have a gridded dataset.
> 
> Is there a "getStartTime()" equivalent for Gridded datasets,

You could do something like:

   GridUtil.getDateTimeList(grid).get(0)

> or a more elegant way to find day numbers (1-365) from Gregorian calendar 
> dates?
> 
> dateTime = seqA.getStartTime()
> 
> year = (int)(dateTime.formattedString("yyyy", tz))
> month = (int)(dateTime.formattedString("MM", tz))
> day = (int)(dateTime.formattedString("dd", tz))

You could do:

julian = (int) (dateTime.formattedString("DDD", tz)

> # julian Day
> feb=28
> if ((((year % 4) == 0) and not((year % 100) == 0)) or ((year % 400) == 0)):
> feb = 29
> months = [31,feb,31,30,31,30,31,31,30,31,30,31]
> monthdays = 0
> for i in range(0,month-1):
> monthdays = monthdays + months[i]
> julianday = day + monthdays
> print "Julian Day:",julianday

Don

Ticket Details
===================
Ticket ID: CYH-100629
Department: Support IDV
Priority: Normal
Status: Open