Noel,
In your code, you are not incrementing the year array. You start at 1901 but you never increment this.
You need to add a loop across 1901 to 2000. You can also remove that inner loop:
begin
start_year = 1901
end_year = 2000
nmos = 12
nyears = (end_year-start_year)+1
;---Count the number of leap years
nleap = num(isleapyear(ispan(start_year,end_year,1)))
;---Calculate exact size of date/time arrays
ntim = (nleap*366) +(nyears-nleap)*365
time = new (ntim, float, "No_FillValue")
date = new (ntim, integer, "No_FillValue")
n = 0
do ny=start_year,end_year
do nmo=1,nmos
YRM = ny*10000 + nmo*100
ndm = days_in_month(ny,nmo)
time(n:n+ndm-1) = ispan(n,n+ndm-1,1)
date(n:n+ndm-1) = YRM + ispan(1,ndm,1)
n = n + ndm
end do
end do
print(date)
end
On May 14, 2012, at 4:55 PM, Noel Aloysius wrote:
> Hello NCL-talk,
>
> Attached ncl script reads a binary file and writes a netCDF binary. The file it correctly written except the date variable. The date should start at 190101 and finish at 200012.
>
> Lines 26-48 in the script refer to the relevant section.
>
> Thanks in advance,
>
> Noel
>
> <read_binary_write_netCDF.ncl>_______________________________________________
> 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 Tue May 15 08:11:15 2012
This archive was generated by hypermail 2.1.8 : Thu May 17 2012 - 13:42:02 MDT