#! /bin/csh -f
#******************* Allocate Shapefiles Run Script **************************
# Allocates a polygon shapefile's data to an I/O API gridded file
# Oct. 2006, LR 
# Dec. 2007, LR -- projection specification changes
#*****************************************************************************

setenv DEBUG_OUTPUT Y
setenv SA_HOME /projects/b1045/cmaq/Spatial-Allocator

# Set executable
setenv EXE "$SA_HOME/bin/64bits/allocator.exe"

# Set Input Directory
setenv DATADIR $SA_HOME/data
setenv OUTPUT /projects/b1045/montgomery

# Select method of spatial analysis

setenv MIMS_PROCESSING ALLOCATE

setenv TIME time

#set "data" shapefile parameters
setenv GRIDDESC /projects/b1045/wrf-cmaq/input/land/CONUS4K_d02/GRIDDESC

#set parameters for file being allocated
setenv INPUT_FILE_NAME /projects/b1045/cmaq/Spatial-Allocator/data/Spatial-Allocator/data/surfzone/surfzone_poly_st.shp
setenv INPUT_FILE_TYPE ShapeFile
setenv INPUT_FILE_MAP_PRJN "+proj=lcc,+lat_1=33,+lat_2=45,+lat_0=40,+lon_0=-97"
setenv INPUT_FILE_ELLIPSOID "+a=6370000.0,+b=6370000.0"
setenv ALLOCATE_ATTRS TYPE
setenv ALLOC_MODE_FILE ALL_AREAPERCENT

#Set this to SURF_ZONE to create the variables needed for CMAQ OCEANfile
setenv ALLOC_ATTR_TYPE  SURF_ZONE

echo $OUTPUT

# Set name and path of resulting shapefile
setenv OUTPUT_FILE_TYPE IoapiFile
setenv OUTPUT_GRID_NAME CONUS4K_d02
setenv OUTPUT_FILE_MAP_PRJN "+proj=lcc,+lat_1=33,+lat_2=45,+lat_0=40,+lon_0=-97"
setenv OUTPUT_FILE_ELLIPSOID "+a=6370000.0,+b=6370000.0"
setenv OUTPUT_FILE_NAME $OUTPUT/ocean_file_${OUTPUT_GRID_NAME}_try3.ncf
echo "Allocating surf zone data to CMAQ OCEANfile"

$TIME $EXE

