#!/bin/csh -fv 

set echo
set verbose

set nx      = 100  		# number of i grid lines
set nlatn   = 67   		# number of j grid lines in NH
set nlats   = 49   		# number of j grid lines in SH
set nz      = 25		# number of vertical grid levels
set lonnp   = -38.5   		# longitude of North Pole
set latnp   = 72.5   		# latitude  of North Pole
set lonsp   = 1.1   		# longitude of South Pole
set latsp   = -90   		# latitude  of South Pole
set dyeq    = .6   		# dy in degrees at Equator
set dsig    = 15.  		# Gaussian efold-scale at equator
set jcon    = 10    		# jcon = # rows of constant dy at poles
set popgrid = grid.pop.da	# binary grid file
set pltgrid = grid.plot.da	# binary grid file
set cdfgrid = grid.nc		# netcdf grid file
set depgrid = h.da		# binary depth array
set kmtgrid = kmt.da		# binary kmt file
set vrtgrid = gx3v5_vert_grid	# ascii vertical grid file
set topo     = global_topo2_bath_merge_0.5_15.nc	# netcdf topography dataset
set minz     = 5.		# min z in meters
set mink     = 3		# minimum allowed km value
set iocean   = 50		# ocean (i,j) point used to define
set jocean   = 60		#	contiguous ocean.
@ ny      = $nlatn + $nlats  	# number of j grid lines

# !!!SET PLOTTING VIEWPOINTS BELOW!!!

#################################
# SET HERE FILE INPUT
#################################
cat >! input.ns_dipole << EOF
$nx $nlatn $nlats
$lonnp $latnp
$lonsp $latsp
$dyeq $dsig $jcon
1
$pltgrid
1
$popgrid
EOF

cat >! input.paleotopo << EOF
$nx $ny $nz
$pltgrid
$vrtgrid
$topo
1
$depgrid
$minz
1
0
$mink
1
$kmtgrid
EOF

cat >! input.grid_bin2nc << EOF
$nx
$ny
$cdfgrid
$vrtgrid
$kmtgrid
$pltgrid
$popgrid
EOF

#################################
# RUN GRID ROUTINES
#################################
../bin/ns_dipole < input.ns_dipole  >! output.ns_dipole
../bin/paleotopo < input.paleotopo  >! output.paleotopo
../bin/grid_bin2nc < input.grid_bin2nc

#################################
# CLEAN UP
#################################
#/usr/bin/rm -f input.ns_dipole input.paleotopo input.display_hgrid_land

exit(0)
