Thanks Mary. The script you sent computes the daily time series. I want ntim = 1200 for a monthly series. Could you show me how I can modify the code please?<br><br>Thanks,<br>Noel<br><br><br><div class="gmail_quote">On Tue, May 15, 2012 at 10:11 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Noel,<br>
<br>
In your code, you are not incrementing the year array. You start at 1901 but you never increment this.<br>
<br>
You need to add a loop across 1901 to 2000. You can also remove that inner loop:<br>
<br>
begin<br>
start_year = 1901<br>
end_year = 2000<br>
nmos = 12<br>
nyears = (end_year-start_year)+1<br>
<br>
;---Count the number of leap years<br>
nleap = num(isleapyear(ispan(start_year,end_year,1)))<br>
<br>
;---Calculate exact size of date/time arrays<br>
ntim = (nleap*366) +(nyears-nleap)*365<br>
time = new (ntim, float, "No_FillValue")<br>
date = new (ntim, integer, "No_FillValue")<br>
<br>
n = 0<br>
do ny=start_year,end_year<br>
do nmo=1,nmos<br>
YRM = ny*10000 + nmo*100<br>
ndm = days_in_month(ny,nmo)<br>
time(n:n+ndm-1) = ispan(n,n+ndm-1,1)<br>
date(n:n+ndm-1) = YRM + ispan(1,ndm,1)<br>
n = n + ndm<br>
end do<br>
end do<br>
print(date)<br>
end<br>
<div><div class="h5"><br>
<br>
<br>
On May 14, 2012, at 4:55 PM, Noel Aloysius wrote:<br>
<br>
> Hello NCL-talk,<br>
><br>
> 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.<br>
><br>
> Lines 26-48 in the script refer to the relevant section.<br>
><br>
> Thanks in advance,<br>
><br>
> Noel<br>
><br>
</div></div>> <read_binary_write_netCDF.ncl>_______________________________________________<br>
> ncl-talk mailing list<br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote></div><br>