-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathweighted_surrogate.txt
More file actions
89 lines (71 loc) · 2.7 KB
/
weighted_surrogate.txt
File metadata and controls
89 lines (71 loc) · 2.7 KB
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
#!/bin/csh -f
#******************* Weighted Surrogate Run Script ******************
# This script demonstrates the use of a weight function in the MIMS
# Spatial Allocator test case (8 km over Tennessee) using a function
# for the weight. This is just an example - the weight function is not
# supposed to represent a realistic case.
#
# Script created by : Ben Brunk, Carolina Environmental Program
# Last edited : June 2005
#
# Dec. 2007, LR -- projection specification changes
#*********************************************************************
setenv DEBUG_OUTPUT Y
# Set installation directory
setenv SA_HOME ..
# Set directory for output surrogate and shape files
setenv WORK_DIR $SA_HOME/output
# Set Location of shapefiles
setenv DATA $SA_HOME/data
# Set Grid settings
setenv GRIDDESC $DATA/GRIDDESC.txt
setenv OUTPUT_GRID_NAME M08_NASH
setenv OUTPUT_FILE_ELLIPSOID "+a=6370997.0,+b=6370997.0"
# Set Location of executable
setenv EXE $SA_HOME/bin/srgcreate.exe
# Set name and path to temporary surrogate file
setenv SURROGATE_FILE $WORK_DIR/tmp_srg.$OUTPUT_GRID_NAME.txt
# Set name and path to final merged surrogate file from spatial tool
setenv SRG_FILE $WORK_DIR/weighted_srg_$OUTPUT_GRID_NAME.txt
# WRITE_QASUM=YES prints surrogate sums by county in file
# WRITE_SRG_NUMERATOR=YES writes surrogate numerator as comment in file
# WRITE_SRG_DENOMINATOR=YES writes denminator (county totals) for srg weight
setenv WRITE_QASUM YES
setenv WRITE_SRG_NUMERATOR YES
setenv WRITE_SRG_DENOMINATOR YES
# Print header info
setenv WRITE_HEADER NO
# Specify type of data files to use
setenv OUTPUT_FILE_TYPE RegularGrid
setenv DATA_FILE_NAME_TYPE ShapeFile
setenv WEIGHT_FILE_TYPE ShapeFile
# The data polygons should be the shape file containing county polygons
setenv DATA_FILE_NAME $DATA/cnty_tn
setenv DATA_ID_ATTR FIPS_CODE
setenv DATA_FILE_MAP_PRJN "+proj=latlong"
setenv DATA_FILE_ELLIPSOID "+a=6370997.0,+b=6370997.0"
# Set weight projection to that of the EPA files
setenv WEIGHT_FILE_MAP_PRJN "+proj=lcc,+lat_1=33,+lat_2=45,+lat_0=40,+lon_0=-97"
setenv WEIGHT_FILE_ELLIPSOID "+a=6370997.0,+b=6370997.0"
date +%r
# Generate surrogate header line
echo Writing header
$EXE -header > $SRG_FILE
if ( $status != 0 ) then
echo "Error writing surrogate header line"
exit
endif
# set FILTER_FILE to NONE in case it was set in an earlier script execution
setenv FILTER_FILE NONE
echo Generating ports surrogate using a weight function
setenv SURROGATE_ID 4
setenv WEIGHT_FILE_NAME $DATA/tn_ports
setenv WEIGHT_ATTR_LIST USE_FUNCTION
setenv WEIGHT_FUNCTION "BERTHS*2"
setenv OUTPUT_FILE_NAME $WORK_DIR/weighted_ports_$OUTPUT_GRID_NAME
date +%r
$EXE
if ( $status == 0 ) then
more $SURROGATE_FILE >> $SRG_FILE
rm $SURROGATE_FILE
endif