#!/bin/sh

echo ""
echo "UGR SUBSET"

datasetURL="http://localhost:8080/opendap/ugrids/sura_UND_ADCIRC_Hurricane_Ike_2D_final_run_with_waves/Hurricane_Ike_2D_final_run_with_waves.ncml"
echo Dataset URL: $datasetURL

ugrQuery="ugnr(wind_max,\"28.35<y&y<30.14&-95.5<x&x<-93.25\")"
echo query: $ugrQuery


echo ""
echo "Unconstrained $dapRequest Request:"
requestURL="$datasetURL$dapRequest"
echo requestURL: $requestURL
#curl -s $datasetURL$dapRequest

dapRequest=".dods"
echo dapRequest: $dapRequest

echo ""
echo "UGrid constrained $dapRequest Request:"
requestURL="$datasetURL$dapRequest?$ugrQuery"
echo requestURL: $requestURL
curl -s "$requestURL" > ugr_subset$dapRequest
echo ""


dapRequest=".das"
echo dapRequest: $dapRequest

echo ""
echo "UGrid constrained $dapRequest Request:"
requestURL="$datasetURL$dapRequest?$ugrQuery"
echo requestURL: $requestURL
curl -s "$requestURL" > ugr_subset$dapRequest
echo ""


dapRequest=".dds"
echo dapRequest: $dapRequest

echo ""
echo "UGrid constrained $dapRequest Request:"
requestURL="$datasetURL$dapRequest?$ugrQuery"
echo requestURL: $requestURL
curl -s "$requestURL" > ugr_subset$dapRequest
echo ""


dapRequest=".nc4"
echo dapRequest: $dapRequest

echo ""
echo "UGrid constrained $dapRequest Request:"
requestURL="$datasetURL$dapRequest?$ugrQuery"
echo requestURL: $requestURL
curl -s "$requestURL" > ugr_subset$dapRequest
echo ""

dapRequest=".nc"
echo dapRequest: $dapRequest

echo ""
echo "UGrid constrained $dapRequest Request:"
requestURL="$datasetURL$dapRequest?$ugrQuery"
echo requestURL: $requestURL
curl -s "$requestURL" > ugr_subset$dapRequest
echo ""

