You can use "day_of_year", but you need to split the value into separate year, month, and day integers.
http://www.ncl.ucar.edu/Document/Functions/Built-in/day_of_year.shtml
Here's some sample code:
d = 20120305 ; assuming "d" is an int or a long
year = toint(d/10000)
month = toint((d-(year*10000))/100)
day = toint(d-(year*10000)-(month*100))
print("year = " + year)
print("month = " + month)
print("day = " + day)
doy = day_of_year(year,month,day)
print("doy = " + doy)
If YYYYMMDD is a string, then convert it to an integer first using "toint".
--Mary
On Oct 10, 2012, at 10:40 AM, virginie hergault wrote:
> Hi users,
>
> I would like to know how to convert a date YYYYMMDD to the day of the
> year (between 1 and 365) ?
> Is there a function available in ncl for this?
>
> Thank you,
> Virginie
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 10 10:59:29 2012
This archive was generated by hypermail 2.1.8 : Fri Oct 12 2012 - 15:38:19 MDT