I’ve used grdvolume and its output is unexpected. I probably don’t understand the documentation, but the documentation is difficult to follow. (For one, the output format is undocumented.)
I have a mask file in netCDF4 format. Dimensions are lon, lat, and z. z is either 0 or 1.
This command:
grdvolume file.grd -Sn -R$area -C0
produces:
0 14310 14085 1
I assume the first entry is the contour level, the second entry is the volume, the third entry is the area, and the last entry is volume/area. What I don’t understand is how volume is calculated.
From the documentation:
grdvolume reads a 2-D grid file and calculates the volume contained between the surface and the plane specified by the given contour (or zero if not given) and reports the area, volume, and maximum mean height (volume/area).
What is the “surface”? A naive definition of “surface” is a contour level of 0, in which case I expect the volume of the command with -C0 to be 0. (What’s also confusing about this sentence is that the order of area, volume, and volume/area don’t match the order of the output.)
More mystery: the documentation indicates that if I leave out the -C flag, a contour value of 0 is assumed. But this command:
grdvolume file.grd -Sn -R$area
returns:
0 176344 14088 0
The volumes are dramatically different.
The mask file has z values of either 0 or 1. I try this:
grdvolume file.grd -Sn -R$area -C1
and get this:
1 0 0 NaN
How is the area zero? 1s exist in the data.
Furthermore, this:
grdvolume file.grd -Sn -R$area -C-10
produces this:
-10 176368 1777766 10
despite the data lacking any value of -10. And this:
grdvolume file.grd -Sn -R$area -C-2
produces this:
-2 176368 366825 2
which has a different area from the “-10” contour.