The purpose of this vignette is to provide an outline of the steps needed to build a dynamic TOPMODEL implementation using the dynatopGIS package.

Implementation notes

The dynatopGIS package implements a structured, object orientated, data flow. The steps outlined below create a dynatopGIS catchment object to which actions are then applied to generate a model.

The dynatopGIS package is written using the object orientated framework provided by the R6 package. This means that some aspects of working with the objects may appear idiosyncratic for some R users. In using the package as outlined in this vignette these problems are largely obscured, except for the call structure. However, before adapting the code, or doing more complex analysis users should read about R6 class objects (e.g. in the R6 package vignettes or in the Advanced R book). One particular gotcha is when copying an object. Using

my_new_object  <-  my_object

creates a pointer, that is altering my_new_object also alters my_object. To create a new independent copy of my_object use

my_new_object  <-  my_object$clone()

Getting started

The dynatopGIS packages works through a number of steps to generate a Dynamic TOPMODEL object suitable for use in with the dynatop package. Each step generates one or more layers which are saved as raster or shape files into the projects working directory (which is not necessarily the R working directory). A record of these layers is kept in the json format meta data file.

This vignette demonstrates the use of the dynatopGIS package using data from the Swindale catchment in the UK.

To start first load the library

For this vignette we will store the data into a temporary directory

demo_dir <- tempfile("dygis")
dir.create(demo_dir)

and initialise the analysis by creating a new object specifying the location of the meta data file, which will be created if it doesn’t exist.

ctch <- dynatopGIS$new(file.path(demo_dir,"demo"))
#> Creating new folder
#> Starting new project at /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo

Adding catchment data

The basis of the analysis is a rasterised Digital Elevation Model (DEM) of the catchment and a vectorised representation of the river network with attributes. Currently these can be in any format supported by the raster and sp libraries respectively.

However, within the calculations used for sink filling, flow routing and topographic index calculations the raster DEM is presumed to be projected so that is has square cells such that the difference between the cell centres (in meters) does not alter.

For Swindale the suitable DEM and channel files can be found using:

dem_file <- system.file("extdata", "SwindaleDTM40m.tif", package="dynatopGIS", mustWork = TRUE)
channel_file <- system.file("extdata", "SwindaleRiverNetwork.shp", package="dynatopGIS", mustWork = TRUE)

Either the DEM or channel files can be added to the project first. In this case we add the DEM with

dem <- terra::rast(dem_file)
ctch$add_dem(dem)

Note: An additional row and column of NA is added to each edge of the DEM. All raster layers in the project have the same projection, resolution and extent of the extended DEM.

Adding river channel data is more complex. The add_channel method requires a SpatialPolygonsDataFrame as generated by the sp package. Each entry in the data.frame is treated as a length of river channel which requires the following properties

  • name - a label for the channel length
  • endNode - a label for the downstream end of the river length
  • startNode - a label for the upstream end of the river length
  • length - the length in meters
  • area - surface area in square meters

Additional properties are currently kept but ignored with the exception of id which is overwritten.

Since it is possible that these properties are present in a data file under different names some basic preprocessing may be required. The convert_channel function is designed to help with this. To illustrate this let us examine the river network for Swindale

sp_lines <- terra::vect(channel_file)
#> Warning: [vect] Z coordinates ignored
head(sp_lines)
#>  class       : SpatVector 
#>  geometry    : lines 
#>  dimensions  : 6, 11  (geometries, attributes)
#>  extent      : 349884.5, 351675.7, 508614.5, 513074.7  (xmin, xmax, ymin, ymax)
#>  coord. ref. : OSGB36 / British National Grid (EPSG:27700) 
#>  names       :           name1      identifier       startNode         endNode
#>  type        :           <chr>           <chr>           <chr>           <chr>
#>  values      :   Hawthorn Gill 16D0AC09-E0B6-~ 730F01D2-0F4F-~ 72B1A40B-E106-~
#>                Little Mosedal~ 643017BB-01BC-~ 9B06188C-F4C7-~ A19E0D3A-2FA1-~
#>                  Mosedale Beck D2C2703E-A32F-~ B03DB3BD-0E33-~ D649B60C-E631-~
#>         form         flow fictitious length name2 sinkdepth Shape_Leng
#>        <chr>        <chr>      <chr>  <int> <chr>     <num>      <num>
#>  inlandRiver in direction      false    431    NA        -1      431.3
#>  inlandRiver in direction      false    513    NA        -1      513.1
#>  inlandRiver in direction      false    740    NA        -1      739.8

Some of the main properties are present under appropriate names (startNode, endNode, length) but the remainder are missing. Also the river network is defined as a series of lines, rather then polygons. The convert_channel function addresses these shortcomings by - changing the names of the required properties - buffering the line objects to create polygons

The convert_channel function takes a named vector giving the variable names to be use for the properties. If we want to carry over the identifier as the name we could call convert_channel with as follows:

property_names <- c(name="identifier",
                    endNode="endNode",
                    startNode="startNode",
                    length="length")
chn <- convert_channel(sp_lines,property_names)
#> Warning in convert_channel(sp_lines, property_names): Modifying to spatial
#> polygons using default width

Since the data set for Swindale does not contain a channel width the default width of 2m is used for buffering.

The river network can then be added to the project by

ctch$add_channel(chn)

Getting and plotting catchment information

The dynatopGIS class has methods for returning and plotting the GIS data in the project. The names of all the different GIS layers stored is returned by

ctch$get_layer()
#>     layer                                             source
#> 1     dem     /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/dem.tif
#> 2 channel /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/channel.tif

These can be plotted (with or without the channel), for example

ctch$plot_layer("dem", add_channel=TRUE)

or returned, for example

ctch$get_layer("dem")
#> class       : SpatRaster 
#> dimensions  : 163, 124, 1  (nrow, ncol, nlyr)
#> resolution  : 40, 40  (x, y)
#> extent      : 347734, 352694, 507244, 513764  (xmin, xmax, ymin, ymax)
#> coord. ref. : +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs 
#> source      : dem.tif 
#> name        :      dem 
#> min value   : 262.8004 
#> max value   : 710.7533

All layers are returned as RasterLayer objects with the exception of the channel layer which is returned as a SpatialPolygonsDataFrame object.

Filling sinks

For the hill slope to be connected to the river network all DEM cells must drain to those that intersect with the river network.

The algorithm of implemented in the sink_fill method ensures this is the case. Since the algorithm is iterative the execution time of the function is limited by capping the maximum number of iterations. If this limit is reached without completion the method can call again with the “hot start” option to continue from where it finished.

For Swindale, where the example DEM is already partially filled the algorithm only alters a small area near the foot of the catchment.

ctch$sink_fill()

terra::plot( ctch$get_layer('filled_dem') - ctch$get_layer('dem'),
            main="Changes to height")

Computing properties

Two sets of properties are required for Dynamic TOPMODEL. The first set is those required within the evaluation of the model; gradient and contour length. The second set are those used for dividing the catchment up into Hydrological Response Units (HRUs). Traditionally the summary used for the separation of the HRUs is the topographic index, which is the natural logarithm of the upslope area divided by gradient.

These are computed using the formulae in Quinn et al. 1991.

The upstream area is computed by routing down slope with the fraction of the area being routed to the next downstream pixel being proportional to the gradient times the contour length.

The local value of the gradient is computed using the average of a subset of between pixel gradients. For a normal ‘hill slope’ cell these are the gradients to downslope pixels weighted by contour length. In the case of pixels which contain river channels the average of the gradients from upslope pixels weighted by contour length us used.

These properties are computed in an algorithm that passes over the data once in descending height. It is called as follows

ctch$compute_properties()

The plot of the topographic index shows a pattern of increasing values closer to the river channels

## plot of topographic index (log(a/tan b))
ctch$plot_layer('atb')

Adding additional layer

Properties may come in additional GIS layers. To demonstrate the addition of an additional layer we will extract the filled dem

tmp <- ctch$get_layer("filled_dem")

then separate it into a layers representing land above and below 500m.

tmp <- terra::classify( tmp,
                          matrix(c(0,500,NA,
                                   500,1000,-999),
                                 ncol=3,byrow=TRUE))

The resulting raster object can now be added to the project with

ctch$add_layer(tmp, "greater_500")
ctch$get_layer()
#>          layer                                                  source
#> 1          dem          /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/dem.tif
#> 2      channel      /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/channel.tif
#> 3   filled_dem   /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/filled_dem.tif
#> 4     gradient     /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/gradient.tif
#> 5 upslope_area /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/upslope_area.tif
#> 6          atb          /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/atb.tif
#> 7  greater_500  /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/greater_500.tif

Flow distances and ordering

Since dynatop simulations make use of ordered HRUs to work downslope, a metric is required to order the downslope sequencing. The calculation of four such metrics is supported

  • shortest flow length - the shortest length based on the pixel flow paths to a channel
  • Dominant flow length - the distance to a channel moving in the dominant (largest fraction) flow direction from any grid cell
  • Expected flow length - the distance to the channel based on a weighted average of the downslope flow lengths. Weights are given by the fraction of flow in each direction.
  • Band - A strict computational order, starting at the channel arranged such that if all pixels in band \(i+1,i+2,\ldots\) are evaluated the inflows to band \(i\) are known.

The computation is initiated with

ctch$compute_flow_lengths()
#> Warning in .getSpatDF(x@ptr$df): NAs introduced by coercion to integer range
#> Warning in .getSpatDF(x@ptr$df, ...): NAs introduced by coercion to integer
#> range

The additional layers can be examined as expected

ctch$get_layer()
#>                   layer
#> 1                   dem
#> 2               channel
#> 3            filled_dem
#> 4              gradient
#> 5          upslope_area
#> 6                   atb
#> 7           greater_500
#> 8                  band
#> 9  shortest_flow_length
#> 10 dominant_flow_length
#> 11 expected_flow_length
#>                                                             source
#> 1                   /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/dem.tif
#> 2               /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/channel.tif
#> 3            /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/filled_dem.tif
#> 4              /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/gradient.tif
#> 5          /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/upslope_area.tif
#> 6                   /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/atb.tif
#> 7           /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/greater_500.tif
#> 8                  /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/band.tif
#> 9  /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/shortest_flow_length.tif
#> 10 /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/dominant_flow_length.tif
#> 11 /tmp/RtmpFb8DWA/dygis1eee4e2b5813/demo/expected_flow_length.tif
ctch$plot_layer("band")

Classifying into Hydrological Response Units

Methods are provided for the classification of the catchment areas of similar hydrological response. The classifications generated in this process are augmented with a further distance based separation when generating a dynatop model (see following section).

By definition each channel length is treated as belonging to a single class.

To classify the hillslope two methods can be used.

The classify method of a dynatopGIS allows a landscape property to be cut into classes.

For example to cut the topographic index for Swindale into 21 classes:

ctch$classify("atb_20","atb",cuts=20)
ctch$plot_layer("atb_20")

Providing a single value to the cuts argument determines the number of classes. The values used to cut the variable can be extracted from the meta data with

ctch$get_method("atb_20")
#> $type
#> [1] "classification"
#> 
#> $layer
#> [1] "atb"
#> 
#> $cuts
#>  [1]  8.6361  9.3714 10.1066 10.8418 11.5771 12.3123 13.0476 13.7828 14.5181
#> [10] 15.2533 15.9885 16.7238 17.4590 18.1943 18.9295 19.6647 20.4000 21.1352
#> [19] 21.8705 22.6057 23.3410

The combine_classes method of a dynatopGIS allows classes to be combined in two ways, which are applied in the order shown

  • pairing - where unique combinations of classes create one new class
  • burning - where a single class is imposed upon an area

To demonstrate a pairing combination consider combining the atb classes generated above with the classification provided by the distance band

ctch$combine_classes("atb_20_band",c("atb_20","band"))
ctch$plot_layer("atb_20_band")

Additionally the land greater then 500 in altitude can be burnt in with

ctch$combine_classes("atb_20_band_500",pairs=c("atb_20","band"),burns="greater_500")
ctch$plot_layer("atb_20_band_500")

The each class in the combined classification the values of the classes used in the computations can be returned

head( ctch$get_method("atb_20_band_500") )
#> $type
#> [1] "combination"
#> 
#> $groups
#>      atb_20_band_500 atb_20 band burns
#> 1                  1      3  194  TRUE
#> 2                  2      4    3 FALSE
#> 3                  3      6    2 FALSE
#> 4                  4      5    3 FALSE
#> 5                  5      6    3 FALSE
#> 6                  6      5    4 FALSE
#> 7                  7      3    6 FALSE
#> 8                  8      1    8 FALSE
#> 9                  9      5    5 FALSE
#> 10                10      4    6 FALSE
#> 11                11      3    7 FALSE
#> 12                12      2    8 FALSE
#> 13                13      6    5 FALSE
#> 14                14      5    6 FALSE
#> 15                15      4    7 FALSE
#> 16                16      3    8 FALSE
#> 17                17      9    3 FALSE
#> 18                18      8    4 FALSE
#> 19                19      7    5 FALSE
#> 20                20      6    6 FALSE
#> 21                21      5    7 FALSE
#> 22                22      4    8 FALSE
#> 23                23      3    9 FALSE
#> 24                24      2   10 FALSE
#> 25                25     10    3 FALSE
#> 26                26      9    4 FALSE
#> 27                27      8    5 FALSE
#> 28                28      7    6 FALSE
#> 29                29      6    7 FALSE
#> 30                30      5    8 FALSE
#> 31                31      4    9 FALSE
#> 32                32      3   10 FALSE
#> 33                33      2   11 FALSE
#> 34                34      1   12 FALSE
#> 35                35     12    2 FALSE
#> 36                36      9    5 FALSE
#> 37                37      8    6 FALSE
#> 38                38      7    7 FALSE
#> 39                39      6    8 FALSE
#> 40                40      5    9 FALSE
#> 41                41      4   10 FALSE
#> 42                42      3   11 FALSE
#> 43                43      2   12 FALSE
#> 44                44      1   13 FALSE
#> 45                45      9    6 FALSE
#> 46                46      8    7 FALSE
#> 47                47      7    8 FALSE
#> 48                48      6    9 FALSE
#> 49                49      5   10 FALSE
#> 50                50      4   11 FALSE
#> 51                51      3   12 FALSE
#> 52                52      9    7 FALSE
#> 53                53      8    8 FALSE
#> 54                54      7    9 FALSE
#> 55                55      6   10 FALSE
#> 56                56      5   11 FALSE
#> 57                57      4   12 FALSE
#> 58                58      3   13 FALSE
#> 59                59      2   14 FALSE
#> 60                60      1   15 FALSE
#> 61                61     11    6 FALSE
#> 62                62      9    8 FALSE
#> 63                63      8    9 FALSE
#> 64                64      7   10 FALSE
#> 65                65      6   11 FALSE
#> 66                66      5   12 FALSE
#> 67                67      4   13 FALSE
#> 68                68      3   14 FALSE
#> 69                69      2   15 FALSE
#> 70                70     12    6 FALSE
#> 71                71     11    7 FALSE
#> 72                72     10    8 FALSE
#> 73                73      9    9 FALSE
#> 74                74      8   10 FALSE
#> 75                75      7   11 FALSE
#> 76                76      6   12 FALSE
#> 77                77      5   13 FALSE
#> 78                78      4   14 FALSE
#> 79                79      3   15 FALSE
#> 80                80      2   16 FALSE
#> 81                81     15    4 FALSE
#> 82                82     13    6 FALSE
#> 83                83     11    8 FALSE
#> 84                84     10    9 FALSE
#> 85                85      9   10 FALSE
#> 86                86      8   11 FALSE
#> 87                87      7   12 FALSE
#> 88                88      6   13 FALSE
#> 89                89      5   14 FALSE
#> 90                90      4   15 FALSE
#> 91                91      3   16 FALSE
#> 92                92      2   17 FALSE
#> 93                93      1   18 FALSE
#> 94                94     15    5 FALSE
#> 95                95     14    6 FALSE
#> 96                96     13    7 FALSE
#> 97                97     12    8 FALSE
#> 98                98     11    9 FALSE
#> 99                99     10   10 FALSE
#> 100              100      9   11 FALSE
#> 101              101      8   12 FALSE
#> 102              102      7   13 FALSE
#> 103              103      6   14 FALSE
#> 104              104      5   15 FALSE
#> 105              105      4   16 FALSE
#> 106              106      3   17 FALSE
#> 107              107      2   18 FALSE
#> 108              108     16    5 FALSE
#> 109              109     14    7 FALSE
#> 110              110     12    9 FALSE
#> 111              111     11   10 FALSE
#> 112              112     10   11 FALSE
#> 113              113      9   12 FALSE
#> 114              114      8   13 FALSE
#> 115              115      7   14 FALSE
#> 116              116      6   15 FALSE
#> 117              117      5   16 FALSE
#> 118              118      4   17 FALSE
#> 119              119      3   18 FALSE
#> 120              120      2   19 FALSE
#> 121              121      1   20 FALSE
#> 122              122     19    3 FALSE
#> 123              123     13    9 FALSE
#> 124              124     12   10 FALSE
#> 125              125     11   11 FALSE
#> 126              126     10   12 FALSE
#> 127              127      9   13 FALSE
#> 128              128      8   14 FALSE
#> 129              129      7   15 FALSE
#> 130              130      6   16 FALSE
#> 131              131      5   17 FALSE
#> 132              132      4   18 FALSE
#> 133              133      3   19 FALSE
#> 134              134      2   20 FALSE
#> 135              135      1   21 FALSE
#> 136              136     14    9 FALSE
#> 137              137     13   10 FALSE
#> 138              138     10   13 FALSE
#> 139              139      9   14 FALSE
#> 140              140      8   15 FALSE
#> 141              141      7   16 FALSE
#> 142              142      6   17 FALSE
#> 143              143      5   18 FALSE
#> 144              144      4   19 FALSE
#> 145              145      3   20 FALSE
#> 146              146      2   21 FALSE
#> 147              147     17    7 FALSE
#> 148              148     14   10 FALSE
#> 149              149     12   12 FALSE
#> 150              150     11   13 FALSE
#> 151              151      9   15 FALSE
#> 152              152      8   16 FALSE
#> 153              153      7   17 FALSE
#> 154              154      6   18 FALSE
#> 155              155      5   19 FALSE
#> 156              156      4   20 FALSE
#> 157              157      3   21 FALSE
#> 158              158      2   22 FALSE
#> 159              159     17    8 FALSE
#> 160              160     14   11 FALSE
#> 161              161     11   14 FALSE
#> 162              162     10   15 FALSE
#> 163              163      9   16 FALSE
#> 164              164      8   17 FALSE
#> 165              165      7   18 FALSE
#> 166              166      6   19 FALSE
#> 167              167      5   20 FALSE
#> 168              168      4   21 FALSE
#> 169              169      3   22 FALSE
#> 170              170      2   23 FALSE
#> 171              171      1   24 FALSE
#> 172              172     13   13 FALSE
#> 173              173     12   14 FALSE
#> 174              174     11   15 FALSE
#> 175              175     10   16 FALSE
#> 176              176      9   17 FALSE
#> 177              177      8   18 FALSE
#> 178              178      7   19 FALSE
#> 179              179      6   20 FALSE
#> 180              180      5   21 FALSE
#> 181              181      4   22 FALSE
#> 182              182      3   23 FALSE
#> 183              183      2   24 FALSE
#> 184              184      1   25 FALSE
#> 185              185     19    8 FALSE
#> 186              186     14   13 FALSE
#> 187              187     13   14 FALSE
#> 188              188     12   15 FALSE
#> 189              189     11   16 FALSE
#> 190              190     10   17 FALSE
#> 191              191      9   18 FALSE
#> 192              192      8   19 FALSE
#> 193              193      7   20 FALSE
#> 194              194      6   21 FALSE
#> 195              195      5   22 FALSE
#> 196              196      4   23 FALSE
#> 197              197      3   24 FALSE
#> 198              198      2   25 FALSE
#> 199              199      1   26 FALSE
#> 200              200     11   17 FALSE
#> 201              201     10   18 FALSE
#> 202              202      9   19 FALSE
#> 203              203      8   20 FALSE
#> 204              204      7   21 FALSE
#> 205              205      6   22 FALSE
#> 206              206      5   23 FALSE
#> 207              207      4   24 FALSE
#> 208              208      3   25 FALSE
#> 209              209      2   26 FALSE
#> 210              210      1   27 FALSE
#> 211              211     11   18 FALSE
#> 212              212     10   19 FALSE
#> 213              213      9   20 FALSE
#> 214              214      8   21 FALSE
#> 215              215      7   22 FALSE
#> 216              216      6   23 FALSE
#> 217              217      5   24 FALSE
#> 218              218      4   25 FALSE
#> 219              219      3   26 FALSE
#> 220              220      2   27 FALSE
#> 221              221      1   28 FALSE
#> 222              222      0   29 FALSE
#> 223              223     11   19 FALSE
#> 224              224     10   20 FALSE
#> 225              225      9   21 FALSE
#> 226              226      8   22 FALSE
#> 227              227      7   23 FALSE
#> 228              228      6   24 FALSE
#> 229              229      5   25 FALSE
#> 230              230      4   26 FALSE
#> 231              231      3   27 FALSE
#> 232              232      2   28 FALSE
#> 233              233      1   29 FALSE
#> 234              234      0   30 FALSE
#> 235              235     10   21 FALSE
#> 236              236      9   22 FALSE
#> 237              237      8   23 FALSE
#> 238              238      7   24 FALSE
#> 239              239      6   25 FALSE
#> 240              240      5   26 FALSE
#> 241              241      4   27 FALSE
#> 242              242      3   28 FALSE
#> 243              243      2   29 FALSE
#> 244              244      1   30 FALSE
#> 245              245      0   31 FALSE
#> 246              246     10   22 FALSE
#> 247              247      8   24 FALSE
#> 248              248      7   25 FALSE
#> 249              249      6   26 FALSE
#> 250              250      5   27 FALSE
#> 251              251      4   28 FALSE
#> 252              252      3   29 FALSE
#> 253              253      2   30 FALSE
#> 254              254      1   31 FALSE
#> 255              255      0   32 FALSE
#> 256              256     11   22 FALSE
#> 257              257      9   24 FALSE
#> 258              258      8   25 FALSE
#> 259              259      7   26 FALSE
#> 260              260      6   27 FALSE
#> 261              261      5   28 FALSE
#> 262              262      4   29 FALSE
#> 263              263      3   30 FALSE
#> 264              264      2   31 FALSE
#> 265              265      1   32 FALSE
#> 266              266      0   33 FALSE
#> 267              267     11   23 FALSE
#> 268              268     10   24 FALSE
#> 269              269      8   26 FALSE
#> 270              270      7   27 FALSE
#> 271              271      6   28 FALSE
#> 272              272      5   29 FALSE
#> 273              273      4   30 FALSE
#> 274              274      3   31 FALSE
#> 275              275      2   32 FALSE
#> 276              276      1   33 FALSE
#> 277              277      0   34 FALSE
#> 278              278     11   24 FALSE
#> 279              279      8   27 FALSE
#> 280              280      7   28 FALSE
#> 281              281      6   29 FALSE
#> 282              282      5   30 FALSE
#> 283              283      4   31 FALSE
#> 284              284      3   32 FALSE
#> 285              285      2   33 FALSE
#> 286              286      1   34 FALSE
#> 287              287      0   35 FALSE
#> 288              288     10   26 FALSE
#> 289              289      8   28 FALSE
#> 290              290      7   29 FALSE
#> 291              291      6   30 FALSE
#> 292              292      5   31 FALSE
#> 293              293      4   32 FALSE
#> 294              294      3   33 FALSE
#> 295              295      2   34 FALSE
#> 296              296      1   35 FALSE
#> 297              297      0   36 FALSE
#> 298              298     12   25 FALSE
#> 299              299     10   27 FALSE
#> 300              300      9   28 FALSE
#> 301              301      8   29 FALSE
#> 302              302      7   30 FALSE
#> 303              303      6   31 FALSE
#> 304              304      5   32 FALSE
#> 305              305      4   33 FALSE
#> 306              306      3   34 FALSE
#> 307              307      2   35 FALSE
#> 308              308      1   36 FALSE
#> 309              309      0   37 FALSE
#> 310              310     11   27 FALSE
#> 311              311     10   28 FALSE
#> 312              312      9   29 FALSE
#> 313              313      8   30 FALSE
#> 314              314      7   31 FALSE
#> 315              315      6   32 FALSE
#> 316              316      5   33 FALSE
#> 317              317      4   34 FALSE
#> 318              318      3   35 FALSE
#> 319              319      2   36 FALSE
#> 320              320      1   37 FALSE
#> 321              321      0   38 FALSE
#> 322              322     11   28 FALSE
#> 323              323     10   29 FALSE
#> 324              324      9   30 FALSE
#> 325              325      7   32 FALSE
#> 326              326      6   33 FALSE
#> 327              327      5   34 FALSE
#> 328              328      4   35 FALSE
#> 329              329      3   36 FALSE
#> 330              330      2   37 FALSE
#> 331              331      1   38 FALSE
#> 332              332      0   39 FALSE
#> 333              333      9   31 FALSE
#> 334              334      8   32 FALSE
#> 335              335      6   34 FALSE
#> 336              336      5   35 FALSE
#> 337              337      4   36 FALSE
#> 338              338      3   37 FALSE
#> 339              339      2   38 FALSE
#> 340              340      1   39 FALSE
#> 341              341      0   40 FALSE
#> 342              342     10   31 FALSE
#> 343              343      9   32 FALSE
#> 344              344      8   33 FALSE
#> 345              345      7   34 FALSE
#> 346              346      6   35 FALSE
#> 347              347      5   36 FALSE
#> 348              348      4   37 FALSE
#> 349              349      3   38 FALSE
#> 350              350      2   39 FALSE
#> 351              351      1   40 FALSE
#> 352              352      0   41 FALSE
#> 353              353      9   33 FALSE
#> 354              354      8   34 FALSE
#> 355              355      7   35 FALSE
#> 356              356      6   36 FALSE
#> 357              357      5   37 FALSE
#> 358              358      4   38 FALSE
#> 359              359      3   39 FALSE
#> 360              360      2   40 FALSE
#> 361              361      1   41 FALSE
#> 362              362      0   42 FALSE
#> 363              363     10   33 FALSE
#> 364              364      9   34 FALSE
#> 365              365      8   35 FALSE
#> 366              366      7   36 FALSE
#> 367              367      6   37 FALSE
#> 368              368      5   38 FALSE
#> 369              369      4   39 FALSE
#> 370              370      3   40 FALSE
#> 371              371      2   41 FALSE
#> 372              372      1   42 FALSE
#> 373              373      0   43 FALSE
#> 374              374     11   33 FALSE
#> 375              375      9   35 FALSE
#> 376              376      7   37 FALSE
#> 377              377      6   38 FALSE
#> 378              378      5   39 FALSE
#> 379              379      4   40 FALSE
#> 380              380      3   41 FALSE
#> 381              381      2   42 FALSE
#> 382              382      1   43 FALSE
#> 383              383      0   44 FALSE
#> 384              384     10   35 FALSE
#> 385              385      6   39 FALSE
#> 386              386      5   40 FALSE
#> 387              387      4   41 FALSE
#> 388              388      3   42 FALSE
#> 389              389      2   43 FALSE
#> 390              390      1   44 FALSE
#> 391              391      0   45 FALSE
#> 392              392      9   37 FALSE
#> 393              393      7   39 FALSE
#> 394              394      6   40 FALSE
#> 395              395      5   41 FALSE
#> 396              396      4   42 FALSE
#> 397              397      3   43 FALSE
#> 398              398      2   44 FALSE
#> 399              399      1   45 FALSE
#> 400              400      0   46 FALSE
#> 401              401     10   37 FALSE
#> 402              402      9   38 FALSE
#> 403              403      8   39 FALSE
#> 404              404      7   40 FALSE
#> 405              405      6   41 FALSE
#> 406              406      5   42 FALSE
#> 407              407      4   43 FALSE
#> 408              408      3   44 FALSE
#> 409              409      2   45 FALSE
#> 410              410      1   46 FALSE
#> 411              411      8   40 FALSE
#> 412              412      6   42 FALSE
#> 413              413      5   43 FALSE
#> 414              414      4   44 FALSE
#> 415              415      3   45 FALSE
#> 416              416      2   46 FALSE
#> 417              417      1   47 FALSE
#> 418              418      0   48 FALSE
#> 419              419     13   36 FALSE
#> 420              420      9   40 FALSE
#> 421              421      8   41 FALSE
#> 422              422      7   42 FALSE
#> 423              423      6   43 FALSE
#> 424              424      5   44 FALSE
#> 425              425      4   45 FALSE
#> 426              426      3   46 FALSE
#> 427              427      2   47 FALSE
#> 428              428      1   48 FALSE
#> 429              429      8   42 FALSE
#> 430              430      7   43 FALSE
#> 431              431      6   44 FALSE
#> 432              432      5   45 FALSE
#> 433              433      4   46 FALSE
#> 434              434      3   47 FALSE
#> 435              435      2   48 FALSE
#> 436              436      1   49 FALSE
#> 437              437      0   50 FALSE
#> 438              438     10   41 FALSE
#> 439              439      9   42 FALSE
#> 440              440      8   43 FALSE
#> 441              441      7   44 FALSE
#> 442              442      6   45 FALSE
#> 443              443      5   46 FALSE
#> 444              444      4   47 FALSE
#> 445              445      3   48 FALSE
#> 446              446      2   49 FALSE
#> 447              447      1   50 FALSE
#> 448              448      0   51 FALSE
#> 449              449      8   44 FALSE
#> 450              450      7   45 FALSE
#> 451              451      6   46 FALSE
#> 452              452      5   47 FALSE
#> 453              453      4   48 FALSE
#> 454              454      3   49 FALSE
#> 455              455      2   50 FALSE
#> 456              456      1   51 FALSE
#> 457              457      0   52 FALSE
#> 458              458      9   44 FALSE
#> 459              459      8   45 FALSE
#> 460              460      7   46 FALSE
#> 461              461      6   47 FALSE
#> 462              462      5   48 FALSE
#> 463              463      4   49 FALSE
#> 464              464      3   50 FALSE
#> 465              465      2   51 FALSE
#> 466              466      1   52 FALSE
#> 467              467      0   53 FALSE
#> 468              468     11   43 FALSE
#> 469              469      9   45 FALSE
#> 470              470      8   46 FALSE
#> 471              471      7   47 FALSE
#> 472              472      6   48 FALSE
#> 473              473      5   49 FALSE
#> 474              474      4   50 FALSE
#> 475              475      3   51 FALSE
#> 476              476      2   52 FALSE
#> 477              477      1   53 FALSE
#> 478              478      0   54 FALSE
#> 479              479     11   44 FALSE
#> 480              480      8   47 FALSE
#> 481              481      7   48 FALSE
#> 482              482      6   49 FALSE
#> 483              483      5   50 FALSE
#> 484              484      4   51 FALSE
#> 485              485      3   52 FALSE
#> 486              486      2   53 FALSE
#> 487              487      1   54 FALSE
#> 488              488      0   55 FALSE
#> 489              489     10   46 FALSE
#> 490              490      9   47 FALSE
#> 491              491      8   48 FALSE
#> 492              492      7   49 FALSE
#> 493              493      6   50 FALSE
#> 494              494      5   51 FALSE
#> 495              495      4   52 FALSE
#> 496              496      3   53 FALSE
#> 497              497      2   54 FALSE
#> 498              498      1   55 FALSE
#> 499              499      0   56 FALSE
#> 500              500      9   48 FALSE
#> 501              501      8   49 FALSE
#> 502              502      7   50 FALSE
#> 503              503      6   51 FALSE
#> 504              504      5   52 FALSE
#> 505              505      4   53 FALSE
#> 506              506      3   54 FALSE
#> 507              507      2   55 FALSE
#> 508              508      1   56 FALSE
#> 509              509      0   57 FALSE
#> 510              510     12   46 FALSE
#> 511              511      7   51 FALSE
#> 512              512      6   52 FALSE
#> 513              513      5   53 FALSE
#> 514              514      4   54 FALSE
#> 515              515      3   55 FALSE
#> 516              516      2   56 FALSE
#> 517              517      1   57 FALSE
#> 518              518     11   48 FALSE
#> 519              519      9   50 FALSE
#> 520              520      8   51 FALSE
#> 521              521      7   52 FALSE
#> 522              522      6   53 FALSE
#> 523              523      5   54 FALSE
#> 524              524      4   55 FALSE
#> 525              525      3   56 FALSE
#> 526              526      2   57 FALSE
#> 527              527      1   58 FALSE
#> 528              528     10   50 FALSE
#> 529              529      9   51 FALSE
#> 530              530      8   52 FALSE
#> 531              531      7   53 FALSE
#> 532              532      6   54 FALSE
#> 533              533      5   55 FALSE
#> 534              534      4   56 FALSE
#> 535              535      3   57 FALSE
#> 536              536      2   58 FALSE
#> 537              537      1   59 FALSE
#> 538              538      0   60 FALSE
#> 539              539     10   51 FALSE
#> 540              540      9   52 FALSE
#> 541              541      8   53 FALSE
#> 542              542      7   54 FALSE
#> 543              543      6   55 FALSE
#> 544              544      5   56 FALSE
#> 545              545      4   57 FALSE
#> 546              546      3   58 FALSE
#> 547              547      2   59 FALSE
#> 548              548      1   60 FALSE
#> 549              549      9   53 FALSE
#> 550              550      8   54 FALSE
#> 551              551      7   55 FALSE
#> 552              552      6   56 FALSE
#> 553              553      5   57 FALSE
#> 554              554      4   58 FALSE
#> 555              555      3   59 FALSE
#> 556              556      2   60 FALSE
#> 557              557      1   61 FALSE
#> 558              558      8   55 FALSE
#> 559              559      7   56 FALSE
#> 560              560      6   57 FALSE
#> 561              561      5   58 FALSE
#> 562              562      4   59 FALSE
#> 563              563      3   60 FALSE
#> 564              564      2   61 FALSE
#> 565              565      1   62 FALSE
#> 566              566     10   54 FALSE
#> 567              567      9   55 FALSE
#> 568              568      8   56 FALSE
#> 569              569      6   58 FALSE
#> 570              570      5   59 FALSE
#> 571              571      4   60 FALSE
#> 572              572      3   61 FALSE
#> 573              573      2   62 FALSE
#> 574              574      1   63 FALSE
#> 575              575      0   64 FALSE
#> 576              576      9   56 FALSE
#> 577              577      8   57 FALSE
#> 578              578      7   58 FALSE
#> 579              579      6   59 FALSE
#> 580              580      5   60 FALSE
#> 581              581      4   61 FALSE
#> 582              582      3   62 FALSE
#> 583              583      2   63 FALSE
#> 584              584      1   64 FALSE
#> 585              585      6   60 FALSE
#> 586              586      5   61 FALSE
#> 587              587      4   62 FALSE
#> 588              588      3   63 FALSE
#> 589              589      2   64 FALSE
#> 590              590      1   65 FALSE
#> 591              591      0   66 FALSE
#> 592              592     10   57 FALSE
#> 593              593      7   60 FALSE
#> 594              594      6   61 FALSE
#> 595              595      5   62 FALSE
#> 596              596      4   63 FALSE
#> 597              597      3   64 FALSE
#> 598              598      2   65 FALSE
#> 599              599      1   66 FALSE
#> 600              600      0   67 FALSE
#> 601              601     10   58 FALSE
#> 602              602      9   59 FALSE
#> 603              603      8   60 FALSE
#> 604              604      6   62 FALSE
#> 605              605      5   63 FALSE
#> 606              606      4   64 FALSE
#> 607              607      3   65 FALSE
#> 608              608      2   66 FALSE
#> 609              609      1   67 FALSE
#> 610              610      0   68 FALSE
#> 611              611     10   59 FALSE
#> 612              612      9   60 FALSE
#> 613              613      8   61 FALSE
#> 614              614      7   62 FALSE
#> 615              615      6   63 FALSE
#> 616              616      5   64 FALSE
#> 617              617      4   65 FALSE
#> 618              618      3   66 FALSE
#> 619              619      2   67 FALSE
#> 620              620      1   68 FALSE
#> 621              621     11   59 FALSE
#> 622              622      9   61 FALSE
#> 623              623      8   62 FALSE
#> 624              624      6   64 FALSE
#> 625              625      5   65 FALSE
#> 626              626      4   66 FALSE
#> 627              627      3   67 FALSE
#> 628              628      2   68 FALSE
#> 629              629      1   69 FALSE
#> 630              630      6   65 FALSE
#> 631              631      5   66 FALSE
#> 632              632      4   67 FALSE
#> 633              633      3   68 FALSE
#> 634              634      2   69 FALSE
#> 635              635      1   70 FALSE
#> 636              636      0   71 FALSE
#> 637              637     10   62 FALSE
#> 638              638      9   63 FALSE
#> 639              639      7   65 FALSE
#> 640              640      6   66 FALSE
#> 641              641      5   67 FALSE
#> 642              642      4   68 FALSE
#> 643              643      3   69 FALSE
#> 644              644      2   70 FALSE
#> 645              645      1   71 FALSE
#> 646              646     10   63 FALSE
#> 647              647      9   64 FALSE
#> 648              648      8   65 FALSE
#> 649              649      7   66 FALSE
#> 650              650      6   67 FALSE
#> 651              651      5   68 FALSE
#> 652              652      4   69 FALSE
#> 653              653      3   70 FALSE
#> 654              654      2   71 FALSE
#> 655              655      1   72 FALSE
#> 656              656     13   61 FALSE
#> 657              657     10   64 FALSE
#> 658              658      8   66 FALSE
#> 659              659      6   68 FALSE
#> 660              660      5   69 FALSE
#> 661              661      4   70 FALSE
#> 662              662      3   71 FALSE
#> 663              663      2   72 FALSE
#> 664              664      1   73 FALSE
#> 665              665      9   66 FALSE
#> 666              666      6   69 FALSE
#> 667              667      5   70 FALSE
#> 668              668      4   71 FALSE
#> 669              669      3   72 FALSE
#> 670              670      2   73 FALSE
#> 671              671      1   74 FALSE
#> 672              672      6   70 FALSE
#> 673              673      5   71 FALSE
#> 674              674      4   72 FALSE
#> 675              675      3   73 FALSE
#> 676              676      2   74 FALSE
#> 677              677      1   75 FALSE
#> 678              678     11   66 FALSE
#> 679              679     10   67 FALSE
#> 680              680      9   68 FALSE
#> 681              681      6   71 FALSE
#> 682              682      5   72 FALSE
#> 683              683      4   73 FALSE
#> 684              684      3   74 FALSE
#> 685              685      2   75 FALSE
#> 686              686      1   76 FALSE
#> 687              687      9   69 FALSE
#> 688              688      6   72 FALSE
#> 689              689      5   73 FALSE
#> 690              690      4   74 FALSE
#> 691              691      3   75 FALSE
#> 692              692      2   76 FALSE
#> 693              693      7   72 FALSE
#> 694              694      6   73 FALSE
#> 695              695      5   74 FALSE
#> 696              696      4   75 FALSE
#> 697              697      3   76 FALSE
#> 698              698      2   77 FALSE
#> 699              699      1   78 FALSE
#> 700              700      0   79 FALSE
#> 701              701      8   72 FALSE
#> 702              702      7   73 FALSE
#> 703              703      6   74 FALSE
#> 704              704      5   75 FALSE
#> 705              705      4   76 FALSE
#> 706              706      3   77 FALSE
#> 707              707      2   78 FALSE
#> 708              708     13   68 FALSE
#> 709              709     11   70 FALSE
#> 710              710      7   74 FALSE
#> 711              711      6   75 FALSE
#> 712              712      5   76 FALSE
#> 713              713      4   77 FALSE
#> 714              714      3   78 FALSE
#> 715              715      2   79 FALSE
#> 716              716      1   80 FALSE
#> 717              717     11   71 FALSE
#> 718              718      9   73 FALSE
#> 719              719      6   76 FALSE
#> 720              720      5   77 FALSE
#> 721              721      4   78 FALSE
#> 722              722      3   79 FALSE
#> 723              723      2   80 FALSE
#> 724              724      9   74 FALSE
#> 725              725      7   76 FALSE
#> 726              726      6   77 FALSE
#> 727              727      5   78 FALSE
#> 728              728      4   79 FALSE
#> 729              729      3   80 FALSE
#> 730              730      2   81 FALSE
#> 731              731     11   73 FALSE
#> 732              732      7   77 FALSE
#> 733              733      6   78 FALSE
#> 734              734      5   79 FALSE
#> 735              735      4   80 FALSE
#> 736              736      3   81 FALSE
#> 737              737      2   82 FALSE
#> 738              738     16   69 FALSE
#> 739              739     10   75 FALSE
#> 740              740      9   76 FALSE
#> 741              741      5   80 FALSE
#> 742              742      4   81 FALSE
#> 743              743      3   82 FALSE
#> 744              744      2   83 FALSE
#> 745              745     16   70 FALSE
#> 746              746     11   75 FALSE
#> 747              747      9   77 FALSE
#> 748              748      7   79 FALSE
#> 749              749      6   80 FALSE
#> 750              750      5   81 FALSE
#> 751              751      4   82 FALSE
#> 752              752      3   83 FALSE
#> 753              753      2   84 FALSE
#> 754              754      1   85 FALSE
#> 755              755     13   74 FALSE
#> 756              756      8   79 FALSE
#> 757              757      6   81 FALSE
#> 758              758      5   82 FALSE
#> 759              759      4   83 FALSE
#> 760              760      3   84 FALSE
#> 761              761      2   85 FALSE
#> 762              762      1   86 FALSE
#> 763              763     12   76 FALSE
#> 764              764      7   81 FALSE
#> 765              765      6   82 FALSE
#> 766              766      5   83 FALSE
#> 767              767      4   84 FALSE
#> 768              768      3   85 FALSE
#> 769              769      2   86 FALSE
#> 770              770      1   87 FALSE
#> 771              771      9   80 FALSE
#> 772              772      7   82 FALSE
#> 773              773      6   83 FALSE
#> 774              774      5   84 FALSE
#> 775              775      4   85 FALSE
#> 776              776      3   86 FALSE
#> 777              777      2   87 FALSE
#> 778              778      1   88 FALSE
#> 779              779     13   77 FALSE
#> 780              780     12   78 FALSE
#> 781              781     10   80 FALSE
#> 782              782      9   81 FALSE
#> 783              783      7   83 FALSE
#> 784              784      6   84 FALSE
#> 785              785      5   85 FALSE
#> 786              786      4   86 FALSE
#> 787              787      3   87 FALSE
#> 788              788      2   88 FALSE
#> 789              789      1   89 FALSE
#> 790              790      7   84 FALSE
#> 791              791      6   85 FALSE
#> 792              792      5   86 FALSE
#> 793              793      4   87 FALSE
#> 794              794      3   88 FALSE
#> 795              795      2   89 FALSE
#> 796              796      1   90 FALSE
#> 797              797      6   86 FALSE
#> 798              798      5   87 FALSE
#> 799              799      4   88 FALSE
#> 800              800      3   89 FALSE
#> 801              801      2   90 FALSE
#> 802              802     12   81 FALSE
#> 803              803     11   82 FALSE
#> 804              804     10   83 FALSE
#> 805              805      7   86 FALSE
#> 806              806      6   87 FALSE
#> 807              807      5   88 FALSE
#> 808              808      4   89 FALSE
#> 809              809      3   90 FALSE
#> 810              810      2   91 FALSE
#> 811              811      8   86 FALSE
#> 812              812      7   87 FALSE
#> 813              813      5   89 FALSE
#> 814              814      4   90 FALSE
#> 815              815      3   91 FALSE
#> 816              816      2   92 FALSE
#> 817              817      1   93 FALSE
#> 818              818     11   84 FALSE
#> 819              819      8   87 FALSE
#> 820              820      6   89 FALSE
#> 821              821      5   90 FALSE
#> 822              822      4   91 FALSE
#> 823              823      3   92 FALSE
#> 824              824      2   93 FALSE
#> 825              825     11   85 FALSE
#> 826              826      7   89 FALSE
#> 827              827      6   90 FALSE
#> 828              828      5   91 FALSE
#> 829              829      4   92 FALSE
#> 830              830      3   93 FALSE
#> 831              831      2   94 FALSE
#> 832              832      1   95 FALSE
#> 833              833     11   86 FALSE
#> 834              834      9   88 FALSE
#> 835              835      8   89 FALSE
#> 836              836      6   91 FALSE
#> 837              837      5   92 FALSE
#> 838              838      4   93 FALSE
#> 839              839      3   94 FALSE
#> 840              840      2   95 FALSE
#> 841              841     10   88 FALSE
#> 842              842      8   90 FALSE
#> 843              843      7   91 FALSE
#> 844              844      6   92 FALSE
#> 845              845      5   93 FALSE
#> 846              846      4   94 FALSE
#> 847              847      3   95 FALSE
#> 848              848      2   96 FALSE
#> 849              849     10   89 FALSE
#> 850              850      7   92 FALSE
#> 851              851      6   93 FALSE
#> 852              852      5   94 FALSE
#> 853              853      4   95 FALSE
#> 854              854      3   96 FALSE
#> 855              855      2   97 FALSE
#> 856              856     10   90 FALSE
#> 857              857      5   95 FALSE
#> 858              858      4   96 FALSE
#> 859              859      3   97 FALSE
#> 860              860      2   98 FALSE
#> 861              861      1   99 FALSE
#> 862              862      8   93 FALSE
#> 863              863      5   96 FALSE
#> 864              864      4   97 FALSE
#> 865              865      3   98 FALSE
#> 866              866      2   99 FALSE
#> 867              867      1  100 FALSE
#> 868              868     11   91 FALSE
#> 869              869     10   92 FALSE
#> 870              870      7   95 FALSE
#> 871              871      6   96 FALSE
#> 872              872      5   97 FALSE
#> 873              873      4   98 FALSE
#> 874              874      3   99 FALSE
#> 875              875      2  100 FALSE
#> 876              876      1  101 FALSE
#> 877              877     10   93 FALSE
#> 878              878      6   97 FALSE
#> 879              879      5   98 FALSE
#> 880              880      4   99 FALSE
#> 881              881      3  100 FALSE
#> 882              882      2  101 FALSE
#> 883              883      1  102 FALSE
#> 884              884      9   95 FALSE
#> 885              885      5   99 FALSE
#> 886              886      4  100 FALSE
#> 887              887      3  101 FALSE
#> 888              888      2  102 FALSE
#> 889              889      1  103 FALSE
#> 890              890      0  104 FALSE
#> 891              891     12   93 FALSE
#> 892              892     11   94 FALSE
#> 893              893      9   96 FALSE
#> 894              894      8   97 FALSE
#> 895              895      6   99 FALSE
#> 896              896      5  100 FALSE
#> 897              897      4  101 FALSE
#> 898              898      3  102 FALSE
#> 899              899      2  103 FALSE
#> 900              900      9   97 FALSE
#> 901              901      8   98 FALSE
#> 902              902      7   99 FALSE
#> 903              903      5  101 FALSE
#> 904              904      4  102 FALSE
#> 905              905      3  103 FALSE
#> 906              906      2  104 FALSE
#> 907              907      1  105 FALSE
#> 908              908      7  100 FALSE
#> 909              909      6  101 FALSE
#> 910              910      5  102 FALSE
#> 911              911      4  103 FALSE
#> 912              912      3  104 FALSE
#> 913              913      2  105 FALSE
#> 914              914      1  106 FALSE
#> 915              915      9   99 FALSE
#> 916              916      8  100 FALSE
#> 917              917      7  101 FALSE
#> 918              918      6  102 FALSE
#> 919              919      5  103 FALSE
#> 920              920      4  104 FALSE
#> 921              921      3  105 FALSE
#> 922              922      2  106 FALSE
#> 923              923      1  107 FALSE
#> 924              924      7  102 FALSE
#> 925              925      6  103 FALSE
#> 926              926      5  104 FALSE
#> 927              927      4  105 FALSE
#> 928              928      3  106 FALSE
#> 929              929      2  107 FALSE
#> 930              930      1  108 FALSE
#> 931              931      7  103 FALSE
#> 932              932      5  105 FALSE
#> 933              933      4  106 FALSE
#> 934              934      3  107 FALSE
#> 935              935      2  108 FALSE
#> 936              936      1  109 FALSE
#> 937              937     10  101 FALSE
#> 938              938      5  106 FALSE
#> 939              939      4  107 FALSE
#> 940              940      3  108 FALSE
#> 941              941      2  109 FALSE
#> 942              942      1  110 FALSE
#> 943              943      7  105 FALSE
#> 944              944      6  106 FALSE
#> 945              945      5  107 FALSE
#> 946              946      4  108 FALSE
#> 947              947      3  109 FALSE
#> 948              948      2  110 FALSE
#> 949              949      6  107 FALSE
#> 950              950      4  109 FALSE
#> 951              951      3  110 FALSE
#> 952              952      2  111 FALSE
#> 953              953      1  112 FALSE
#> 954              954     11  103 FALSE
#> 955              955      8  106 FALSE
#> 956              956      6  108 FALSE
#> 957              957      5  109 FALSE
#> 958              958      4  110 FALSE
#> 959              959      3  111 FALSE
#> 960              960      2  112 FALSE
#> 961              961      1  113 FALSE
#> 962              962      7  108 FALSE
#> 963              963      6  109 FALSE
#> 964              964      5  110 FALSE
#> 965              965      4  111 FALSE
#> 966              966      3  112 FALSE
#> 967              967      2  113 FALSE
#> 968              968      1  114 FALSE
#> 969              969      6  110 FALSE
#> 970              970      5  111 FALSE
#> 971              971      4  112 FALSE
#> 972              972      3  113 FALSE
#> 973              973      2  114 FALSE
#> 974              974     13  104 FALSE
#> 975              975      8  109 FALSE
#> 976              976      7  110 FALSE
#> 977              977      6  111 FALSE
#> 978              978      5  112 FALSE
#> 979              979      4  113 FALSE
#> 980              980      3  114 FALSE
#> 981              981      2  115 FALSE
#> 982              982      1  116 FALSE
#> 983              983     13  105 FALSE
#> 984              984     12  106 FALSE
#> 985              985     10  108 FALSE
#> 986              986      6  112 FALSE
#> 987              987      5  113 FALSE
#> 988              988      4  114 FALSE
#> 989              989      3  115 FALSE
#> 990              990      2  116 FALSE
#> 991              991     10  109 FALSE
#> 992              992      9  110 FALSE
#> 993              993      8  111 FALSE
#> 994              994      7  112 FALSE
#> 995              995      5  114 FALSE
#> 996              996      4  115 FALSE
#> 997              997      3  116 FALSE
#> 998              998      2  117 FALSE
#> 999              999      1  118 FALSE
#> 1000            1000     13  107 FALSE
#> 1001            1001      9  111 FALSE
#> 1002            1002      8  112 FALSE
#> 1003            1003      5  115 FALSE
#> 1004            1004      4  116 FALSE
#> 1005            1005      3  117 FALSE
#> 1006            1006      2  118 FALSE
#> 1007            1007      1  119 FALSE
#> 1008            1008      8  113 FALSE
#> 1009            1009      5  116 FALSE
#> 1010            1010      4  117 FALSE
#> 1011            1011      3  118 FALSE
#> 1012            1012      2  119 FALSE
#> 1013            1013      1  120 FALSE
#> 1014            1014      8  114 FALSE
#> 1015            1015      4  118 FALSE
#> 1016            1016      3  119 FALSE
#> 1017            1017      2  120 FALSE
#> 1018            1018      1  121 FALSE
#> 1019            1019     10  113 FALSE
#> 1020            1020      8  115 FALSE
#> 1021            1021      7  116 FALSE
#> 1022            1022      6  117 FALSE
#> 1023            1023      4  119 FALSE
#> 1024            1024      3  120 FALSE
#> 1025            1025      2  121 FALSE
#> 1026            1026      1  122 FALSE
#> 1027            1027     10  114 FALSE
#> 1028            1028      9  115 FALSE
#> 1029            1029      5  119 FALSE
#> 1030            1030      4  120 FALSE
#> 1031            1031      3  121 FALSE
#> 1032            1032      2  122 FALSE
#> 1033            1033      8  117 FALSE
#> 1034            1034      6  119 FALSE
#> 1035            1035      5  120 FALSE
#> 1036            1036      4  121 FALSE
#> 1037            1037      3  122 FALSE
#> 1038            1038      2  123 FALSE
#> 1039            1039      1  124 FALSE
#> 1040            1040      9  117 FALSE
#> 1041            1041      4  122 FALSE
#> 1042            1042      3  123 FALSE
#> 1043            1043      2  124 FALSE
#> 1044            1044      1  125 FALSE
#> 1045            1045     11  116 FALSE
#> 1046            1046      9  118 FALSE
#> 1047            1047      8  119 FALSE
#> 1048            1048      7  120 FALSE
#> 1049            1049      5  122 FALSE
#> 1050            1050      4  123 FALSE
#> 1051            1051      3  124 FALSE
#> 1052            1052      2  125 FALSE
#> 1053            1053      1  126 FALSE
#> 1054            1054     10  118 FALSE
#> 1055            1055      7  121 FALSE
#> 1056            1056      6  122 FALSE
#> 1057            1057      5  123 FALSE
#> 1058            1058      4  124 FALSE
#> 1059            1059      3  125 FALSE
#> 1060            1060      2  126 FALSE
#> 1061            1061      1  127 FALSE
#> 1062            1062      6  123 FALSE
#> 1063            1063      5  124 FALSE
#> 1064            1064      4  125 FALSE
#> 1065            1065      3  126 FALSE
#> 1066            1066      2  127 FALSE
#> 1067            1067      1  128 FALSE
#> 1068            1068     10  120 FALSE
#> 1069            1069      8  122 FALSE
#> 1070            1070      6  124 FALSE
#> 1071            1071      5  125 FALSE
#> 1072            1072      4  126 FALSE
#> 1073            1073      3  127 FALSE
#> 1074            1074      2  128 FALSE
#> 1075            1075      1  129 FALSE
#> 1076            1076      8  123 FALSE
#> 1077            1077      7  124 FALSE
#> 1078            1078      5  126 FALSE
#> 1079            1079      4  127 FALSE
#> 1080            1080      3  128 FALSE
#> 1081            1081      2  129 FALSE
#> 1082            1082      6  126 FALSE
#> 1083            1083      5  127 FALSE
#> 1084            1084      4  128 FALSE
#> 1085            1085      3  129 FALSE
#> 1086            1086     12  121 FALSE
#> 1087            1087      8  125 FALSE
#> 1088            1088      6  127 FALSE
#> 1089            1089      5  128 FALSE
#> 1090            1090      4  129 FALSE
#> 1091            1091      3  130 FALSE
#> 1092            1092      2  131 FALSE
#> 1093            1093      1  132 FALSE
#> 1094            1094      5  129 FALSE
#> 1095            1095      4  130 FALSE
#> 1096            1096      3  131 FALSE
#> 1097            1097      2  132 FALSE
#> 1098            1098      1  133 FALSE
#> 1099            1099     16  119 FALSE
#> 1100            1100      9  126 FALSE
#> 1101            1101      8  127 FALSE
#> 1102            1102      7  128 FALSE
#> 1103            1103      6  129 FALSE
#> 1104            1104      5  130 FALSE
#> 1105            1105      4  131 FALSE
#> 1106            1106      3  132 FALSE
#> 1107            1107      2  133 FALSE
#> 1108            1108      1  134 FALSE
#> 1109            1109      8  128 FALSE
#> 1110            1110      7  129 FALSE
#> 1111            1111      5  131 FALSE
#> 1112            1112      4  132 FALSE
#> 1113            1113      3  133 FALSE
#> 1114            1114      2  134 FALSE
#> 1115            1115      1  135 FALSE
#> 1116            1116     13  124 FALSE
#> 1117            1117     12  125 FALSE
#> 1118            1118      9  128 FALSE
#> 1119            1119      7  130 FALSE
#> 1120            1120      6  131 FALSE
#> 1121            1121      5  132 FALSE
#> 1122            1122      4  133 FALSE
#> 1123            1123      3  134 FALSE
#> 1124            1124      2  135 FALSE
#> 1125            1125     12  126 FALSE
#> 1126            1126      8  130 FALSE
#> 1127            1127      6  132 FALSE
#> 1128            1128      5  133 FALSE
#> 1129            1129      4  134 FALSE
#> 1130            1130      3  135 FALSE
#> 1131            1131      2  136 FALSE
#> 1132            1132     12  127 FALSE
#> 1133            1133      8  131 FALSE
#> 1134            1134      7  132 FALSE
#> 1135            1135      6  133 FALSE
#> 1136            1136      5  134 FALSE
#> 1137            1137      4  135 FALSE
#> 1138            1138      3  136 FALSE
#> 1139            1139      2  137 FALSE
#> 1140            1140      6  134 FALSE
#> 1141            1141      5  135 FALSE
#> 1142            1142      4  136 FALSE
#> 1143            1143      3  137 FALSE
#> 1144            1144      2  138 FALSE
#> 1145            1145      7  134 FALSE
#> 1146            1146      6  135 FALSE
#> 1147            1147      5  136 FALSE
#> 1148            1148      4  137 FALSE
#> 1149            1149      3  138 FALSE
#> 1150            1150      2  139 FALSE
#> 1151            1151      5  137 FALSE
#> 1152            1152      4  138 FALSE
#> 1153            1153      3  139 FALSE
#> 1154            1154      2  140 FALSE
#> 1155            1155      6  137 FALSE
#> 1156            1156      5  138 FALSE
#> 1157            1157      4  139 FALSE
#> 1158            1158      3  140 FALSE
#> 1159            1159      2  141 FALSE
#> 1160            1160      1  142 FALSE
#> 1161            1161      6  138 FALSE
#> 1162            1162      5  139 FALSE
#> 1163            1163      4  140 FALSE
#> 1164            1164      3  141 FALSE
#> 1165            1165      2  142 FALSE
#> 1166            1166      6  139 FALSE
#> 1167            1167      4  141 FALSE
#> 1168            1168      3  142 FALSE
#> 1169            1169      2  143 FALSE
#> 1170            1170      6  140 FALSE
#> 1171            1171      5  141 FALSE
#> 1172            1172      4  142 FALSE
#> 1173            1173      3  143 FALSE
#> 1174            1174      2  144 FALSE
#> 1175            1175      5  142 FALSE
#> 1176            1176      4  143 FALSE
#> 1177            1177      3  144 FALSE
#> 1178            1178      2  145 FALSE
#> 1179            1179      5  143 FALSE
#> 1180            1180      4  144 FALSE
#> 1181            1181      3  145 FALSE
#> 1182            1182      2  146 FALSE
#> 1183            1183      6  143 FALSE
#> 1184            1184      5  144 FALSE
#> 1185            1185      4  145 FALSE
#> 1186            1186      3  146 FALSE
#> 1187            1187      2  147 FALSE
#> 1188            1188      1  148 FALSE
#> 1189            1189      6  144 FALSE
#> 1190            1190      4  146 FALSE
#> 1191            1191      3  147 FALSE
#> 1192            1192      2  148 FALSE
#> 1193            1193      6  145 FALSE
#> 1194            1194      5  146 FALSE
#> 1195            1195      4  147 FALSE
#> 1196            1196      3  148 FALSE
#> 1197            1197      4  148 FALSE
#> 1198            1198      3  149 FALSE
#> 1199            1199      2  150 FALSE
#> 1200            1200      6  147 FALSE
#> 1201            1201      5  148 FALSE
#> 1202            1202      4  149 FALSE
#> 1203            1203      2  151 FALSE
#> 1204            1204      6  148 FALSE
#> 1205            1205      5  149 FALSE
#> 1206            1206      4  150 FALSE
#> 1207            1207      3  151 FALSE
#> 1208            1208      5  150 FALSE
#> 1209            1209      4  151 FALSE
#> 1210            1210      3  152 FALSE
#> 1211            1211      2  153 FALSE
#> 1212            1212      4  152 FALSE
#> 1213            1213      3  153 FALSE
#> 1214            1214      2  154 FALSE
#> 1215            1215      4  153 FALSE
#> 1216            1216      3  154 FALSE
#> 1217            1217      3  155 FALSE
#> 1218            1218      2  156 FALSE
#> 1219            1219      1  157 FALSE
#> 1220            1220      5  154 FALSE
#> 1221            1221      4  155 FALSE
#> 1222            1222      3  156 FALSE
#> 1223            1223      2  157 FALSE
#> 1224            1224      1  158 FALSE
#> 1225            1225      4  156 FALSE
#> 1226            1226      3  157 FALSE
#> 1227            1227      1  159 FALSE
#> 1228            1228      4  157 FALSE
#> 1229            1229      3  158 FALSE
#> 1230            1230      2  159 FALSE
#> 1231            1231      6  156 FALSE
#> 1232            1232      4  158 FALSE
#> 1233            1233      2  160 FALSE
#> 1234            1234      4  159 FALSE
#> 1235            1235      4  160 FALSE
#> 1236            1236      5  160 FALSE
#> 1237            1237      6  161 FALSE
#> 1238            1238      6  162 FALSE

Note that by giving the area to be burnt in a negative value when it was generated above we have ensured that the values do not clash with those generated by the cuts which (except potentially when a cut is NA) which will always be positive.

Generating a dynamic TOPMODEL

A Dynamic TOPMODEL suitable for use with the dynatop package can be generated using the create_model method. This uses an existing classification to generate the model. The required model structure is given in the vignettes of dynatop package and is not described here in details.

Since dynatop simulations make use of ordered HRUs to work downslope, a classification which used a distance layer (see earlier section) which represents the ordered downslope sequencing of the pixels is recommended.

Even if a distance layer is not used in the classification one must be given to the create_model method, so the resulting HRUs can be ordered.

Currently only the ‘band’ distance metric as used below will produce valid model.

For example, in the case of the division of Swindale by topographic index into 21 classes and the bands directly the resulting model can be generated by

ctch$create_model(file.path(demo_dir,"new_model"),"atb_20_band","band")

Looking at the files within the demo_dir folder

list.files(demo_dir,pattern="new_model*")
#> [1] "new_model.rds" "new_model.tif"

shows that an addition raster map of the HRUs has been created in new_model.tif along with a file new_model.rds containing a model suitable for dynatop. The values on the map correspond to the ìd column of the hru table in the dynatop model.