This file is indexed.

/usr/bin/scrip_check_input is in ncl-ncarg 6.3.0-13.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/csh -f
#
#       $Id: scrip_check_input,v 1.3 2008-07-27 03:41:28 haley Exp $
#
#       Copyright (C) 2007-2008
#       University Corporation for Atmospheric Research
#       All Rights Reserved
#
#       File:       scrip_check_input
#       Author:     Fred Clare
#
#       National Center for Atmospheric Research
#       POB 3000, Boulder, Colorado
#
#  This script takes as its single argument a NetCDF file used as 
#  an input file for SCRIP and tests whether the coordinates of all 
#  cells are entered in counterclockwise order and also tests whether
#  the cell centers are on the interior (or boundary) of the cells.  
#  For details on SCRIP, see: http://climate.lanl.gov/Software/SCRIP/
#  

set progname = `basename $0`

#
#  Precisely one argument accepted.
#
if (($#argv < 1) || ($#argv > 1)) then
    goto USAGE
endif

set input_file = $1

#
#  Put the NCL script in a temporary file.
#
set tmpdir = `ncargpath tmp`
set tmp_nclf = "$tmpdir/tmp$$.ncl"
/bin/rm $tmp_nclf >& /dev/null

cat << 'EOF_NCL' >! $tmp_nclf
begin

;
;  Check that file_in was specified in the call.
;
  if (.not. isvar("file_in")) then
    print("")
    print("scrip_check_input.ncl - no input file entered.")
    print("")
    return(1)
    exit
  end if

  f = addfile(file_in,"r")
;
; Get variable names in the file.
;
 varnames = getfilevarnames(f) 
;
; Make sure the input file has the required variable names 
; and attributes.
;
  check_varnames = (/"grid_corner_lat", "grid_corner_lon",  \
                     "grid_center_lat", "grid_center_lon"/)

  do i=0,dimsizes(check_varnames)-1
    if(.not.any(check_varnames(i) .eq. varnames)) then
      print("Input file does not contain variable '" + check_varnames(i) + "'.")
      print("Can't continue.")
      exit
    end if
    if(.not.isatt(f->$check_varnames(i)$,"units")) then
      print("'" + check_varnames(i) + "' does not contain 'units' attribute.")
      print("Can't continue.")
      exit
    end if
  end do

  r2d = 180./3.1415926536

;
;  Read the SCRIP input file.
;
  lat_corners = f->grid_corner_lat
  lon_corners = f->grid_corner_lon
  lat_centers = f->grid_center_lat
  lon_centers = f->grid_center_lon
  center_lat_units = f->grid_center_lat@units
  center_lon_units = f->grid_center_lon@units
  corner_lat_units = f->grid_corner_lat@units
  corner_lon_units = f->grid_corner_lon@units

  if (center_lat_units .eq. "radians") then
    conv_center_lat= r2d  
  end if
  if (center_lat_units .eq. "degrees") then
    conv_center_lat= 1.
  end if
  if (center_lat_units.ne."radians" .and. center_lat_units.ne."degrees") then
    print("")
    print("scrip_check_input.ncl - The grid_center_lat units must")
    print("                        be specified as either")
    print("                        'radians' or 'degrees'")
    print("")
    return(1)
  end if

  if (center_lon_units .eq. "radians") then
    conv_center_lon= r2d
  end if
  if (center_lon_units .eq. "degrees") then
    conv_center_lon= 1.
  end if
  if (center_lon_units.ne."radians" .and. center_lon_units.ne."degrees") then
    print("")
    print("scrip_check_input.ncl - The grid_center_lon units must")
    print("                        be specified as either")
    print("                        'radians' or 'degrees'")
    print("")
    return(1)
  end if

  if (corner_lat_units .eq. "radians") then
    conv_corner_lat= r2d
  end if
  if (corner_lat_units .eq. "degrees") then
    conv_corner_lat= 1.
  end if
  if (corner_lat_units.ne."radians" .and. corner_lat_units.ne."degrees") then
    print("")
    print("scrip_check_input.ncl - The grid_corner_lat units must")
    print("                        be specified as either")
    print("                        'radians' or 'degrees'")
    print("")
    return(1)
  end if

  if (corner_lon_units .eq. "radians") then
    conv_corner_lon= r2d
  end if
  if (corner_lon_units .eq. "degrees") then
    conv_corner_lon= 1.
  end if
  if (corner_lon_units.ne."radians" .and. corner_lon_units.ne."degrees") then
    print("")
    print("scrip_check_input.ncl - The grid_corner_lon units must")
    print("                        be specified as either")
    print("                        'radians' or 'degrees'")
    print("")
    return(1)
  end if

  clck = gc_clkwise(conv_corner_lat*lat_corners,    \
                    conv_corner_lon*lon_corners)
  if (num(ind(clck)) .gt. 0) then
    print("scrip_check_input - The corner points for cells with the")
    print("                    following indices are not listed in ")
    print("                    counterclockwise order: ")
    print("                     " + ind(clck))
  end if
  if (num(ind(clck)) .eq. 0) then
    print("scrip_check_input - point ordering (counterclockwise) test")
    print("                    for input cells completed, no errors.")
    print("")
  end if

  ierror = 0
  do i=0,dimsizes(lat_centers)-1
    inside = gc_inout(conv_center_lat*lat_centers(i),    \
                      conv_center_lon*lon_centers(i),    \
                      conv_center_lat*lat_corners(i,:),  \
                      conv_center_lon*lon_corners(i,:))
    if (inside .eq. False) then
      print("scrip_check_input - The center point for the cell with the")
      print("                    following cell index is not within or on")
      print("                    the cell boundary: " + i)
      ierror = 1
    end if
  end do

  if (ierror .eq. 0) then
    print("scrip_check_input - cell centers inside cells test")
    print("                    completed, no errors.")
  end if

end

'EOF_NCL'

#
#  Execute the NCL script.
#
eval ncl file_in=\\\"$input_file\\\" $tmp_nclf

#
# Clean up
#
/bin/rm -f $tmp_nclf
exit 0

USAGE:
echo ""
echo "Usage:  ${progname} input_file"
echo ""
echo "  input_file   name of the NetCDF-formatted file that is to"
echo "               be used as an input file for the SCRIP package."
echo "               For details on the required file structure and"
echo "               the SCRIP package see:"
echo "               http://climate.lanl.gov/Software/SCRIP/"
echo ""
echo "  This script tests whether the coordinates of all cells "
echo "  in the input file are entered in counterclockwise order "
echo "  and also tests whether the cell centers are on the interior "
echo "  of the cells.  "
echo " "