|
| 1 | +--- |
| 2 | +title: "Extract various measures of evapotranspiration" |
| 3 | +description: > |
| 4 | + This vignette shows how to estimate various measures of the area weighted evapotranspiration. |
| 5 | +output: rmarkdown::html_vignette |
| 6 | +vignette: > |
| 7 | + %\VignetteIndexEntry{Extract various measures of evapotranspiration} |
| 8 | + %\VignetteEngine{knitr::rmarkdown} |
| 9 | + %\usepackage[utf8]{inputenc} |
| 10 | +--- |
| 11 | + |
| 12 | +```{r, include = FALSE} |
| 13 | +knitr::opts_chunk$set(collapse = T, comment = "#>") |
| 14 | +options(tibble.print_min = 4L, tibble.print_max = 4L) |
| 15 | +``` |
| 16 | + |
| 17 | +```{r setup} |
| 18 | +library(AWAPer, warn.conflicts = FALSE) |
| 19 | +``` |
| 20 | + |
| 21 | +This example calculates and plot various estimates of evaportranspiration. Ten different estimates of area weighted evapotranspiration over one year at catchment 407214 (Victoria, Australia) are derived. |
| 22 | +## Make netCDF files |
| 23 | +Like the other vignettes, the netCDF data grids need to be built. |
| 24 | + |
| 25 | +First, let's define the start and end dates for data grids and the file names. |
| 26 | + |
| 27 | +```{r} |
| 28 | +date.from = as.Date("2010-01-01","%Y-%m-%d") |
| 29 | +date.to = as.Date("2010-12-31","%Y-%m-%d") |
| 30 | +
|
| 31 | +ncdfFilename = tempfile(fileext='.nc') |
| 32 | +ncdfSolarFilename = tempfile(fileext='.nc') |
| 33 | +``` |
| 34 | + |
| 35 | +Next, let's make the data grids over this period. |
| 36 | +```{r} |
| 37 | +makeNetCDF_file(ncdfFilename = ncdfFilename, |
| 38 | + ncdfSolarFilename = ncdfSolarFilename, |
| 39 | + updateFrom = date.from, |
| 40 | + updateTo = date.to) |
| 41 | +``` |
| 42 | + |
| 43 | +## Load a catchment boundary |
| 44 | +Now that we have the meteorological data we can begin extracting data for the catchment. Here the catchment boundaries built into the package are used. |
| 45 | +```{r} |
| 46 | +data("catchments") |
| 47 | +``` |
| 48 | + |
| 49 | +## Extract daily precipitation and PET data |
| 50 | +Next, the 11 different measures of evapotranspiration that can be derived from the available gridded data are calculated for 12 months. |
| 51 | + |
| 52 | +The estimation of ET uses the _evapotranspiration_ package. It requires a set of constants, which are loaded as follows. |
| 53 | +```{r} |
| 54 | +data(constants,package='Evapotranspiration') |
| 55 | +``` |
| 56 | + |
| 57 | +Next, all 11 ET measures are derived. For each measure, only the following commands change: _ET.function_ , _ET.timestep_ and _ET.Mortons.est_ (when Morton's estimate is derived). |
| 58 | +```{R} |
| 59 | +climateData.ET.HargreavesSamani = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 60 | + ncdfSolarFilename= ncdfSolarFilename, |
| 61 | + extractFrom= date.from, |
| 62 | + extractTo= date.to, |
| 63 | + locations=catchments, |
| 64 | + spatial.function.name='IQR', |
| 65 | + ET.function='ET.HargreavesSamani', |
| 66 | + ET.timestep = 'daily', |
| 67 | + ET.constants= constants); |
| 68 | +
|
| 69 | +climateData.ET.JensenHaise = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 70 | + ncdfSolarFilename= ncdfSolarFilename, |
| 71 | + extractFrom= date.from, |
| 72 | + extractTo= date.to, |
| 73 | + locations=catchments, |
| 74 | + spatial.function.name='IQR', |
| 75 | + ET.function='ET.JensenHaise', |
| 76 | + ET.timestep = 'daily', |
| 77 | + ET.constants= constants); |
| 78 | +
|
| 79 | +climateData.ET.Makkink = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 80 | + ncdfSolarFilename= ncdfSolarFilename, |
| 81 | + extractFrom= date.from, |
| 82 | + extractTo= date.to, |
| 83 | + locations=catchments, |
| 84 | + spatial.function.name='IQR', |
| 85 | + ET.function='ET.Makkink', |
| 86 | + ET.timestep = 'daily', |
| 87 | + ET.constants= constants); |
| 88 | +
|
| 89 | +climateData.ET.McGuinnessBordne = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 90 | + ncdfSolarFilename= ncdfSolarFilename, |
| 91 | + extractFrom= date.from, |
| 92 | + extractTo= date.to, |
| 93 | + locations=catchments, |
| 94 | + spatial.function.name='IQR', |
| 95 | + ET.function='ET.McGuinnessBordne', |
| 96 | + ET.timestep = 'daily', |
| 97 | + ET.constants= constants); |
| 98 | +
|
| 99 | +climateData.ET.MortonCRAE = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 100 | + ncdfSolarFilename= ncdfSolarFilename, |
| 101 | + extractFrom= date.from, |
| 102 | + extractTo= date.to, |
| 103 | + locations=catchments, |
| 104 | + spatial.function.name='IQR', |
| 105 | + ET.function='ET.MortonCRAE', |
| 106 | + ET.timestep = 'monthly', |
| 107 | + ET.constants= constants); |
| 108 | +
|
| 109 | +climateData.ET.MortonCRAE.potentialET = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 110 | + ncdfSolarFilename= ncdfSolarFilename, |
| 111 | + extractFrom= date.from, |
| 112 | + extractTo= date.to, |
| 113 | + locations=catchments, |
| 114 | + spatial.function.name='IQR', |
| 115 | + ET.function='ET.MortonCRAE', |
| 116 | + ET.timestep = 'monthly', |
| 117 | + ET.Mortons.est='potential ET', |
| 118 | + ET.constants= constants); |
| 119 | +
|
| 120 | +climateData.ET.MortonCRAE.wetarealET = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 121 | + ncdfSolarFilename= ncdfSolarFilename, |
| 122 | + extractFrom= date.from, |
| 123 | + extractTo= date.to, |
| 124 | + locations=catchments, |
| 125 | + spatial.function.name='IQR', |
| 126 | + ET.function='ET.MortonCRAE', |
| 127 | + ET.timestep = 'monthly', |
| 128 | + ET.Mortons.est='wet areal ET', |
| 129 | + ET.constants= constants); |
| 130 | +
|
| 131 | +climateData.ET.MortonCRAE.actualarealET = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 132 | + ncdfSolarFilename= ncdfSolarFilename, |
| 133 | + extractFrom= date.from, |
| 134 | + extractTo= date.to, |
| 135 | + locations=catchments, |
| 136 | + spatial.function.name='IQR', |
| 137 | + ET.function='ET.MortonCRAE', |
| 138 | + ET.timestep = 'monthly', |
| 139 | + ET.Mortons.est='actual areal ET', |
| 140 | + ET.constants= constants); |
| 141 | +
|
| 142 | +climateData.ET.MortonCRWE = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 143 | + ncdfSolarFilename= ncdfSolarFilename, |
| 144 | + extractFrom= date.from, |
| 145 | + extractTo= date.to, |
| 146 | + locations=catchments, |
| 147 | + spatial.function.name='IQR', |
| 148 | + ET.function='ET.MortonCRWE', |
| 149 | + ET.timestep = 'monthly', |
| 150 | + ET.constants= constants); |
| 151 | +
|
| 152 | +climateData.ET.MortonCRWE.shallowLake = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 153 | + ncdfSolarFilename= ncdfSolarFilename, |
| 154 | + extractFrom= date.from, |
| 155 | + extractTo= date.to, |
| 156 | + locations=catchments, |
| 157 | + spatial.function.name='IQR', |
| 158 | + ET.function='ET.MortonCRWE', |
| 159 | + ET.timestep = 'monthly', |
| 160 | + ET.Mortons.est = 'shallow lake ET', |
| 161 | + ET.constants= constants); |
| 162 | +
|
| 163 | +climateData.ET.Turc = extractCatchmentData(ncdfFilename= ncdfFilename, |
| 164 | + ncdfSolarFilename= ncdfSolarFilename, |
| 165 | + extractFrom= date.from, |
| 166 | + extractTo= date.to, |
| 167 | + locations=catchments, |
| 168 | + spatial.function.name='IQR', |
| 169 | + ET.function='ET.Turc', |
| 170 | + ET.timestep = 'daily', |
| 171 | + ET.constants= constants); |
| 172 | +``` |
| 173 | + |
| 174 | +Next each estimate is plotted over time. |
| 175 | + |
| 176 | +```{r} |
| 177 | +#| fig.width = 8, |
| 178 | +#| fig.height = 10 |
| 179 | +filt = climateData.ET.HargreavesSamani$catchmentTemporal.mean$CatchID==407214 |
| 180 | +d = ISOdate(climateData.ET.HargreavesSamani$catchmentTemporal.mean$year, |
| 181 | + climateData.ET.HargreavesSamani$catchmentTemporal.mean$month, |
| 182 | + climateData.ET.HargreavesSamani$catchmentTemporal.mean$day) |
| 183 | +plot(d[filt], climateData.ET.HargreavesSamani$catchmentTemporal.mean$ET_mm[filt], |
| 184 | + col='black',lty=1, xlim = c(ISOdate(2010,1,1), ISOdate(2010,12,1)), |
| 185 | + ylim=c(0, 30),type='l', ylab='ET [mm/d]',xlab='Date') |
| 186 | +
|
| 187 | +filt = climateData.ET.JensenHaise$catchmentTemporal.mean$CatchID==407214 |
| 188 | +d = ISOdate(climateData.ET.JensenHaise$catchmentTemporal.mean$year, |
| 189 | + climateData.ET.JensenHaise$catchmentTemporal.mean$month, |
| 190 | + climateData.ET.JensenHaise$catchmentTemporal.mean$day) |
| 191 | +lines(d[filt], climateData.ET.JensenHaise$catchmentTemporal.mean$ET_mm[filt], |
| 192 | + col='red',lty=1) |
| 193 | +
|
| 194 | +filt = climateData.ET.Makkink$catchmentTemporal.mean$CatchID==407214 |
| 195 | +d = ISOdate(climateData.ET.Makkink$catchmentTemporal.mean$year, |
| 196 | + climateData.ET.Makkink$catchmentTemporal.mean$month, |
| 197 | + climateData.ET.Makkink$catchmentTemporal.mean$day) |
| 198 | +lines(d[filt], climateData.ET.Makkink$catchmentTemporal.mean$ET_mm[filt], |
| 199 | + col='green',lty=1) |
| 200 | +
|
| 201 | +filt = climateData.ET.McGuinnessBordne$catchmentTemporal.mean$CatchID==407214 |
| 202 | +d = ISOdate(climateData.ET.McGuinnessBordne$catchmentTemporal.mean$year, |
| 203 | + climateData.ET.McGuinnessBordne$catchmentTemporal.mean$month, |
| 204 | + climateData.ET.McGuinnessBordne$catchmentTemporal.mean$day) |
| 205 | +lines(d[filt], climateData.ET.McGuinnessBordne$catchmentTemporal.mean$ET_mm[filt], |
| 206 | + col='blue',lty=1) |
| 207 | +
|
| 208 | +filt = climateData.ET.MortonCRAE.potentialET$catchmentTemporal.mean$CatchID==407214 |
| 209 | +d = ISOdate(climateData.ET.MortonCRAE.potentialET$catchmentTemporal.mean$year, |
| 210 | + climateData.ET.MortonCRAE.potentialET$catchmentTemporal.mean$month, |
| 211 | + climateData.ET.MortonCRAE.potentialET$catchmentTemporal.mean$day) |
| 212 | +lines(d[filt], climateData.ET.MortonCRAE.potentialET$catchmentTemporal.mean$ET_mm[filt], |
| 213 | + col='black',lty=2) |
| 214 | +
|
| 215 | +filt = climateData.ET.MortonCRAE.wetarealET$catchmentTemporal.mean$CatchID==407214 |
| 216 | +d = ISOdate(climateData.ET.MortonCRAE.wetarealET$catchmentTemporal.mean$year, |
| 217 | + climateData.ET.MortonCRAE.wetarealET$catchmentTemporal.mean$month, |
| 218 | + climateData.ET.MortonCRAE.wetarealET$catchmentTemporal.mean$day) |
| 219 | +lines(d[filt], climateData.ET.MortonCRAE.wetarealET$catchmentTemporal.mean$ET_mm[filt], |
| 220 | + col='red',lty=2) |
| 221 | +
|
| 222 | +filt = climateData.ET.MortonCRAE.actualarealET$catchmentTemporal.mean$CatchID==407214 |
| 223 | +d = ISOdate(climateData.ET.MortonCRAE.actualarealET$catchmentTemporal.mean$year, |
| 224 | + climateData.ET.MortonCRAE.actualarealET$catchmentTemporal.mean$month, |
| 225 | + climateData.ET.MortonCRAE.actualarealET$catchmentTemporal.mean$day) |
| 226 | +lines(d[filt], climateData.ET.MortonCRAE.actualarealET$catchmentTemporal.mean$ET_mm[filt], |
| 227 | + col='green',lty=2) |
| 228 | +
|
| 229 | +filt = climateData.ET.MortonCRWE$catchmentTemporal.mean$CatchID==407214 |
| 230 | +d = ISOdate(climateData.ET.MortonCRWE$catchmentTemporal.mean$year, |
| 231 | + climateData.ET.MortonCRWE$catchmentTemporal.mean$month, |
| 232 | + climateData.ET.MortonCRWE$catchmentTemporal.mean$day) |
| 233 | +lines(d[filt], climateData.ET.MortonCRWE$catchmentTemporal.mean$ET_mm[filt], |
| 234 | + col='blue',lty=2) |
| 235 | +
|
| 236 | +filt = climateData.ET.MortonCRWE.shallowLake$catchmentTemporal.mean$CatchID==407214 |
| 237 | +d = ISOdate(climateData.ET.MortonCRWE.shallowLake$catchmentTemporal.mean$year, |
| 238 | + climateData.ET.MortonCRWE.shallowLake$catchmentTemporal.mean$month, |
| 239 | + climateData.ET.MortonCRWE.shallowLake$catchmentTemporal.mean$day) |
| 240 | +lines(d[filt], climateData.ET.MortonCRWE.shallowLake$catchmentTemporal.mean$ET_mm[filt], |
| 241 | + col='black',lty=3) |
| 242 | +
|
| 243 | +filt = climateData.ET.Turc$catchmentTemporal.mean$CatchID==407214 |
| 244 | +d = ISOdate(climateData.ET.Turc$catchmentTemporal.mean$year, |
| 245 | + climateData.ET.Turc$catchmentTemporal.mean$month, |
| 246 | + climateData.ET.Turc$catchmentTemporal.mean$day) |
| 247 | +lines(d[filt], climateData.ET.Turc$catchmentTemporal.mean$ET_mm[filt], |
| 248 | + col='red',lty=3) |
| 249 | +
|
| 250 | +legend(x='topright', legend=c( |
| 251 | + 'Hargreaves Samani (ref. crop)', |
| 252 | + 'Jensen Haise (PET)', |
| 253 | + 'Makkink (ref. crop)', |
| 254 | + 'McGuinness Bordne (PET)', |
| 255 | + 'Morton CRAE (PET)', |
| 256 | + 'Morton CRAE (wet areal ET)', |
| 257 | + 'Morton CRAE (actual areal ET)', |
| 258 | + 'Morton CRWE (PET)', |
| 259 | + 'Morton CRWE (shallowLake)', |
| 260 | + 'Turc (ref. crop, non-humid'), |
| 261 | + lty = c(1,1,1,1,2,2,2,2,3,3), |
| 262 | + col=c('black','red','green','blue','black','red','green','blue','black','red') |
| 263 | +) |
| 264 | +``` |
0 commit comments