Simple way to estimate a grid cell area based on latitude

Sometimes I need to convert some flux terms from length unit to volume. For example, 10 mm precipitation over a 0.25 degree grid cell is ? m3 water.The only unknown term here is the area of the grid cell. One easy way to approximate it is to treat this grid cell as a flat rectangle (this problem could be extremely complex if all the details are considered). The length of the latitudinal side remains the same no matter where the grid cell is, but the length of the longitudinal side varies with changing latitude (i.e. largest at equator, zero at poles).
Continue reading

Advertisements

Damn BASH

Spent hours debugging a piece of simple script in which I pass more than 9 arguments from outside. Everything’s fine for arguments 1-9 but bash couldn’t recognize argument 10. Turns out you need to add these damn curly braces on the numbers. Otherwise it will just treat it as $1

Something like this:

#!/bin/bash
 PWD=$1
 BI=$2
 DS=$3
 WS=$4
 EXP=$5
 D2=$6
 D3=$7
 DSMAX=$8
 Inimois2=$9
 Inimois3=${10}