Revision: | 1.2 |
Committed: | Thu Jan 24 07:04:18 2013 UTC (10 years, 8 months ago) by tplarson |
Branch: | MAIN |
CVS Tags: | Ver_8-8, Ver_8-11, Ver_8-2, Ver_8-10, Ver_8-0, Ver_8-1, Ver_8-6, Ver_LATEST, Ver_8-4, Ver_9-41, Ver_8-3, Ver_8-5, Ver_8-12, Ver_8-7, Ver_9-5, Ver_9-4, Ver_9-3, Ver_9-2, Ver_9-1, Ver_9-0, HEAD |
Changes since 1.1: | +29 -11 lines |
Log Message: | can now produce gapfile with arbitrary length and start time |
# | Content |
---|---|
1 | PRO CATGAPS, firstday, ndt, tstep, infile |
2 | |
3 | ppd=long(86400/tstep) |
4 | ndays=long(ndt/ppd) |
5 | lastday=firstday+ndays-1 |
6 | daystr=strtrim(string(firstday),2) |
7 | ndstr=strtrim(string(ndays),2) |
8 | |
9 | spawn,'cat '+infile,hold |
10 | ng=n_elements(hold) |
11 | fdarr=lonarr(ng) |
12 | ndtarr=lonarr(ng) |
13 | filearr=strarr(ng) |
14 | for i=0,ng-1 do begin |
15 | words=strsplit(hold[i],/extract) |
16 | fdarr[i]=long(words[0]) |
17 | ndtarr[i]=long(words[1]) |
18 | filearr[i]=words[2] |
19 | endfor |
20 | |
21 | ldarr=fdarr+(ndtarr*tstep/86400)-1 |
22 | fd=min(fdarr) |
23 | ld=max(ldarr) |
24 | nd=ld-fd+1 |
25 | |
26 | gaps0=fltarr(nd*ppd); |
27 | for i=0,ng-1 do begin |
28 | g=readfits(filearr[i]) |
29 | index=(fdarr[i]-fd)*ppd |
30 | gaps0[index:index+ndtarr[i]-1]=g[*] |
31 | endfor |
32 | |
33 | if (firstday le fd) then begin |
34 | outindex1=(fd - firstday)*ppd |
35 | inindex1=0 |
36 | endif else begin |
37 | outindex1=0 |
38 | inindex1=(firstday - fd)*ppd |
39 | endelse |
40 | if (lastday ge ld) then begin |
41 | outindex2=ndt - (lastday - ld)*ppd - 1 |
42 | inindex2=nd*ppd - 1 |
43 | endif else begin |
44 | outindex2=ndt - 1 |
45 | inindex2=nd*ppd - (ld - lastday)*ppd - 1 |
46 | endelse |
47 | |
48 | gaps=fltarr(ndt); |
49 | gaps[outindex1:outindex2]=gaps0[inindex1:inindex2] |
50 | |
51 | writefits,'gaps.'+ndstr+'.'+daystr+'.fits',gaps |
52 | |
53 | END |