-
Notifications
You must be signed in to change notification settings - Fork 2
/
gap-find.ncl
74 lines (49 loc) · 1.66 KB
/
gap-find.ncl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;;; NCL script to check for gaps in time coordinate
;;; slightly tweaked version: prints output in terse format for
;;; feeding to nctimefill script I wrote
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
function ut_date(time[1])
local date, result
begin
date = ut_calendar(time,-5)
result = ""+date(0,0)+"/"+date(0,1)+"/"+date(0,2)+" "+date(0,3)+":"+date(0,4)+":"+date(0,5)
return(result)
end
;; Uncomment the following variables to hard-code them here, or pass values in via command-line. Example:
;; ncl -x varname=\"prtot\" infile=\"table6/prtot_CRCM_climatology.nc\" outfile=\"plots/prtot_CRCM_s0\" title=\"CRCM\" timestep=\"0\" narccap-generic-plot.ncl
; infile = "table6/prtot_CRCM_climatology.nc"
; tab = " "
if (.not. isvar("step")) then
step = 0.125
end if
;; open file
fin = addfile(infile, "r")
time = fin->time
nt = dimsizes(time)
;print("file:"+tab+infile)
;print("nsteps:"+tab+(nt-1))
;print("units:"+tab+time@units)
;print("first:"+tab+ut_date(time(0)))
;print("last: "+tab+ut_date(time(nt-1)))
;print("gaps")
;print("----")
;print(""+infile)
do i=0,nt-2
delta = time(i+1)-time(i)
if (delta .ne. step) then
print (""+i+" "+(i+1)+" "+(delta/step - 1)+" "+step+" "+infile)
; print("----")
; print (""+i+tab+time(i)+tab+ut_date(time(i)))
; print (""+(i+1)+tab+time(i+1)+tab+ut_date(time(i+1)))
;; print (" "+delta)
; print (tab+delta)
; print("----")
end if
end do
;print("====")
;print("")
exit
;; Copyright 2009-2012 Univ. Corp. for Atmos. Research
;; Author: Seth McGinnis, mcginnis@ucar.edu