Skip to content

Releases: tgoodbody/sgsR

sgsR v1.4.5

03 Mar 17:53
Compare
Choose a tag to compare

sgsR 1.4.5

fixed - sample_balanced() & sample_existing_balanced() - Updated to match BalancedSampling v2.0.6 changes to "algorithm = lcubsestratified". Thanks to Anton Grafström.

Full Changelog: v1.4.4...v1.4.5

sgsR v1.4.4

13 Jun 19:25
Compare
Choose a tag to compare

sgsR 1.4.4

fixed - sample_strat() - Was not taking samples from other strata into account when calculating mindist between sample units. This has now been corrected for both Queinnec and random methods. From Tommasso Trotto #33

enhanced - calculate_distance() - added slope parameter to allow for calculation of slope distance. From Nic #32

enhanced - sample_ahels() - If attributes in existing contain numeric data -- and match columns in mraster -- these data will be used instead of extracting from mraster.

sgsR v.1.4.2

10 Mar 22:29
Compare
Choose a tag to compare

sgsR 1.4.2

added - utils-write - made writing functions for samples, rasters, and tables to make code more succinct.

enhanced - sample_existing - A major change to sample_existing() has been implemented. Prior to sgsR v1.4.2, sample_existing() only leveraged sample_clhs() functionality. New functionality has been added to allow users to define the sub-sampling method of their choice out of (sample_srs(), sample_balanced(), sample_strat(), sample_clhs()). To do so, additional internal functions (sample_existing_strat(), sample_existing_srs(), sample_existing_balanced(), sample_existing_srs()) have been added that take in existing data and perform sampling based on those data. For sample_existing_strat(), new allocation algorithms that take existing as inputs needed to be written that are found in utils-allocation-existing(). Additionally, more utility functions that check existing data, and prepare existing data for sub-sampling have been developed and implemented in utils-existing(). Unit tests for all functions have been added. The plot parameter has been removed from sample_existing() for now. Likely to be added again later.

enhanced - Sampling Vignette - Added content about sample_existing()

fixed - strat_map() - Fixed improper use of terra::hasValues. From Robert Hijmans #31

sgsR v.1.4.0

09 Feb 18:26
Compare
Choose a tag to compare

sgsR 1.4.0

added - sample_sys_strat() - Systematic stratified sampling. Using same functionality as sample_systematic() but takes an sraster as input and performs sampling on each stratum iteratively.

enhanced - strat_breaks() - Vectorized function to allow for any number of input mraster layers and a corresponding number of breaks vectors (as list in respective order as mraster layers). Removed mraster2 & breaks2. Users can now supply an mraster with as many layers as they wish. Added map to allow for creating a combined (mapped) stratification output (strata). Internal function calculate_breaks() was added that facilitates vectorization.

enhanced - strat_quantiles() - Vectorized function to allow for any number of input mraster layers and a corresponding number of breaks vectors (as list in respective order as mraster layers). Removed mraster2 & nStrata2. Users can now supply an mraster with as many layers as they wish along side nStrata as a list with length(nStrata) == terra::nlyr(mraster). nStrata can be either a scalar integer representing the number of desired output strata, or a numeric vector of probabilities between 0-1 demarcating quantile break points. The nStrata list can be a mix of these (e.g. nStrata = list(c(0.1,0.8,1), 4, 9) where mraster would have 3 layers) to allow users to define both explicit quantile breaks or a desired strata number that is converted to quantiles breaks internally. Added map to allow for creating a combined (mapped) stratification output (strata). Internal functions calculate_quantile_breaks() / quantile_breaks_integer() / quantile_breaks() were added that facilitate vectorization.

enhanced - strat_map() - Vectorized function to allow for any number of input mraster layers and a corresponding number of breaks vectors (as list in respective order as mraster layers). Removed raster2. Users can now supply an sraster with as many layers as they wish. Thank you, Tommaso Trotto.

enhanced - Updated vignettes and documentation to account for vectorized functionality of the above functions.

enhanced - plot_scatter() - now visualizes with viridis colour scheme.

fixed - Added new citation information for upcoming manuscript release.

fixed - extract_strata() / extract_metrics() - CRS for existing will now be maintained when provided as an sf and the mraster CRS will be assigned otherwise. In addition, all sampling functions will maintain CRS from existing if possible, otherwise CRS from sraster/mraster are used for output samples.

Manuscript publication and citation:

added - link to open access publication on sgsR.

#> To cite package 'sgsR' in publications use:
#> 
#>   Goodbody, TRH., Coops, NC., Queinnec, M., White, JC., Tompalski, P.,
#>   Hudak, AT., Auty, D., Valbuena, R., LeBoeuf, A., Sinclair, I.,
#>   McCartney, G., Prieur, J-F., Woods, ME. (2023). sgsR: a structurally
#>   guided sampling toolbox for LiDAR-based forest inventories. Forestry:
#>   An International Journal of Forest Research.
#>   10.1093/forestry/cpac055.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Manual{,
#>     title = {sgsR: a structurally guided sampling toolbox for LiDAR-based forest inventories.},
#>     author = {Tristan R.H. Goodbody and Nicholas C. Coops and Martin Queinnec and Joanne C. White and Piotr Tompalski and Andrew T. Hudak and David Auty and Ruben Valbuena and Antoine LeBoeuf and Ian Sinclair and Grant McCartney and Jean-Francois Prieur and Murray E. Woods},
#>     journal = {Forestry: An International Journal of Forest Research},
#>     year = {2023},
#>     doi = {10.1093/forestry/cpac055},
#>   }
#> 
#>   Tristan RH Goodbody, Nicholas C Coops and Martin Queinnec (2023).
#>   Structurally Guided Sampling. R package version 1.4.0.
#>   https://cran.r-project.org/package=sgsR.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Manual{,
#>     title = {Structurally Guided Sampling},
#>     author = {Tristan RH Goodbody and Nicholas C Coops and Martin Queinnec},
#>     year = {2023},
#>     note = {R package version 1.4.0},
#>     url = {https://cran.r-project.org/package=sgsR},
#>   }

sgsR v1.3.4

28 Jan 17:13
Compare
Choose a tag to compare

sgsR 1.3.4

fixed - sample_srs() / sample_strat(method = "random") - First sample unit was always duplicated. From Tommaso Trotto.

added - plot_scatter() - Internal function. Scatter plot visualizing relationship between 2 mraster metrics with existing samples superimposed.

sgsR v.1.3.3

17 Jan 16:08
Compare
Choose a tag to compare

sgsR 1.3.3

fixed - CRAN issue where errors were encountered when run on ATLAS instances.

enhancement - Edited vignettes and documentation for clarity.

enhancement - sample_srs() - Added message to tell users when nSamp sample units were unable to be allocated. From Evan Muise.

sgsR v1.3.2

21 Nov 20:50
Compare
Choose a tag to compare

sgsR 1.3.2

enhancement - README.Rmd and vignettes have been updated.

enhancement - sample_systematic() - changed how tessellation was used internally and visualized during plotting.

fixed - strat_map() - #20 greatly simplified algorithm using suggestion from R. Hijmans (added as author to algorithm). Issue was related to level matching with categorical variables.

fixed - sample_ahels() - swapped plot marker icons to be consistent with other functions.

sgsR v1.3.1

14 Oct 17:45
Compare
Choose a tag to compare

sgsR 1.3.1

fixed - sample_systematic() added random translation to sampling grid to ensure unbiased sampling.

sgsR 1.3.0

new - sample_existing() has been added. This algorithm sub-samples and existing sample using internal latin hypercube sampling. Constraints in the form of the cost parameter akin to sample_clhs() exist. Sub-sampling can be performed on existing samples alone, or using population level mraster distributions.

new - mask_existing() - internal function for masking exising samples using access buffers.

sgsR 1.2.1

fixed - sample_systematic() bug where cellsize values that caused no samples to intersect with the raster would cause extract_metrics() to provide an error about existing not having any samples. Added a check for intersection and corresponding error message.

enhancement - Added quiet to extract_metrics() & extract_strata() to allow internal use without messages.

v1.2.0

08 Aug 17:15
Compare
Choose a tag to compare

Fixes from previous version (v1.0.0)

sgsR 1.2.0

  • fixed - strat_kmeans() bug related to terra where the re-assignment of values to the output raster was causing issues. R Hijmans kindly suggested the edit made.

  • fixed - sample_ahels() - bug where extra attributes in existing would cause the algorithm to crash when re-merging after sampling.

  • fixed - strat_quantiles() no longer plots histogram / scatter plot when using plot = TRUE. Now correctly adds this to details list when details = TRUE.

  • new sampling method - Added sample_nc() based on the algorithm described in Melville & Stone (2016)

    • This algorithm uses kmeans clustering where the number of clusters is equal to the desired number of samples. Cluster centers are located, which then prompts the nearest neighbour raster pixel for each cluster to be located (assuming default k parameter). These nearest neighbours are the output samples. Visualization of the centers and samples can be dispayed if details = TRUE is used and $kplot is plotted.
  • fixed - sample_systematic() now has inherent randomness for lower left corner of the tessellation.

  • fixed - strat_kmeans() solved issue where only first raster layer was being involved in stratification.

sgsR 1.1.0

  • enhanced - sample_strat() - added parameter method that allows users to choose between "Queinnec" (default method implemented in previous sgsR versions) and "random" (stratified random sampling). The random method ignores much of the functionality of the algorithm to allow users to use standard stratified random sampling approaches without the use of a focal window to locate contiguous stratum cells.

  • fixed - sample_strat() factor handling improvement - GitHub issue #18

  • enhanced - calculate_allocation() improved documentation for output data frame to make attributes more clear.

  • fixed - calculate_representation() will now not plot bar chart twice & NA values in existing will not be removed.

  • fixed - existing samples with other attributes will now not break sampling using sample_ahels() / sample_clhs() if values are NA. Variables are also added back to the sample output

sgsR 1.0.0

  • First CRAN release.

v1.0.0

24 Jun 14:27
Compare
Choose a tag to compare

1st CRAN submission of sgsR.