Skip to content

makegrid.sh

Philip Maechling edited this page Apr 22, 2022 · 2 revisions

use makegrid to create a mesh file for cvms4 testing

We have defined two regions that we want to query, and a series of depths. The makegrid.sh script list embedded configuration values. Below are the values used for this exercise

Grid 1:

this is 10m resolution at depths from 80 to 110

34.5 -118.5 33.5 -117.5

HOR_SPACING=0.0001 VERT_SPACING=5 MIN_DEPTH=80 MAX_DEPTH=110 MIN_LON=-118.5 MAX_LON=-117.5 MIN_LAT=33.5 MAX_LAT=34.5

Word count from the output file is:

Grid 2

35.5 -117.5 34.4 -116.5

HOR_SPACING=0.0001 VERT_SPACING=5 MIN_DEPTH=80 MAX_DEPTH=110 MIN_LON=-117.5 MAX_LON=-116.5 MIN_LAT=34.5 MAX_LAT=35.5

makegrid.sh

[ucvm@91e02b10e48d utilities]$ more makegrid.sh
#!/bin/sh
#
# Creates and ASCII grid file with 
# 3272481 mesh points and writes it to
# file grd.out
#
HOR_SPACING=0.1
VERT_SPACING=250
MIN_DEPTH=0
MAX_DEPTH=20000
MIN_LON=-130.0
MAX_LON=-110.0
MIN_LAT=26.0
MAX_LAT=46.0

rm -f out.grd

echo "Generating grid"

for z in `seq ${MIN_DEPTH} ${VERT_SPACING} ${MAX_DEPTH}`; do \
 for y in `seq ${MIN_LAT} ${HOR_SPACING} ${MAX_LAT}`; do \
  for x in `seq ${MIN_LON} ${HOR_SPACING} ${MAX_LON}`; do \
   echo $x $y $z >> out.grd; \
  done; \
 done; \
done;

echo "Done"
Clone this wiki locally