Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v 4.0.0 #35

Merged
merged 67 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
be4e529
change to terra, remove raster dependency
trafficonese Apr 30, 2023
9fba605
cran submission
trafficonese May 1, 2023
417c95d
assign turbine elevation to windlist. Use it in calculation
trafficonese May 1, 2023
19ad967
add heights to get_dist_angles and fix c++ function
trafficonese May 1, 2023
6820188
Add circle_intersection for 3D
trafficonese May 1, 2023
ade37dc
add tests
trafficonese May 1, 2023
17b989a
fix terra extracts [,1], terra crs ?
trafficonese May 1, 2023
5962089
convert CCL raster to terra only if not SpatRaster, otherwise it loos…
trafficonese May 2, 2023
fd15c38
Weibull TODO, topografic adapt
trafficonese May 2, 2023
b6b054f
export terrain_model
trafficonese May 2, 2023
6597b38
weibull change, must be given as raster/SpatRaster/stars
trafficonese May 2, 2023
2d594ed
remove getISO3, change getDEM to use elevatr instead of raster
trafficonese May 2, 2023
4c27033
move elevatr to Suggests
trafficonese May 2, 2023
8fe1c01
remove getISO3 docs
trafficonese May 7, 2023
c06d8a9
fix weibull gamma function
trafficonese May 7, 2023
56a5857
fix terrain model if TRUE, use donttest and omit dontrun
trafficonese May 7, 2023
15ae98b
remove most visibility function, use terra::viewshed instead
trafficonese May 7, 2023
b41ba94
Docs, remove visibility functions, Return Value
trafficonese May 7, 2023
29cf6f9
fix terra plots, return info for plots
trafficonese May 7, 2023
f8f4392
fix weibull errors, build errors, fix tests (dont skip)
trafficonese May 8, 2023
4507b9e
remove windfarmGA function, complete terrain tests
trafficonese May 8, 2023
9d27314
docs
trafficonese May 8, 2023
f66ef1b
add raster to terrain tests, rm windfarmGA tests
trafficonese May 8, 2023
7247457
rm windfarmGA links, donttest visibility, adapt pkgdown, fix terrain …
trafficonese May 8, 2023
0dcbc3e
fix test warnings (add raster to Suggests)
trafficonese May 8, 2023
8a72f4c
use functions for requiredNamespaces for testing
trafficonese May 8, 2023
1e73f3a
fix doParallel pkg_inst?, export and document
trafficonese May 8, 2023
de8250a
fix leaflet_plot if only 1 result, fix tests, with_mock, terrain tests
trafficonese May 8, 2023
2902f67
use message instead of cat/print
trafficonese May 8, 2023
5b7523f
on.exit(par(oldpar)), fix tests
trafficonese May 8, 2023
53e97ea
add News for 4.0.0
trafficonese May 8, 2023
a309d91
merge branch terra
trafficonese May 8, 2023
3d6ee31
3D-circle intersection calculation
trafficonese May 8, 2023
f601eff
fix tests / examples for 3D-calc
trafficonese May 8, 2023
e16ff31
change ' with " and fix trimton bug (some cases), fix examples / tests
trafficonese May 8, 2023
87326d9
remove partial overlap cpp function
trafficonese May 8, 2023
6a6aaf1
fix edgecase 1 turbine
trafficonese May 8, 2023
19a5a2c
also check agains 3.2.3
trafficonese May 8, 2023
e891f32
Depends on R 3.5.0
trafficonese May 9, 2023
c31fd23
Depends on R 3.6.0
trafficonese May 9, 2023
1517d74
remove terra:add_legend test for R 3.6
trafficonese May 9, 2023
9216412
styler
trafficonese May 9, 2023
a91ac29
styler && lintr
trafficonese May 9, 2023
060bfad
styler / lintr
trafficonese May 9, 2023
6fce415
styler / lintr
trafficonese May 9, 2023
13e2157
Merge branch 'master' of https://github.com/trafficonese/windfarmGA
trafficonese May 9, 2023
1996b8e
correct terra imports
trafficonese May 9, 2023
006e64f
fix isSpatial class check, spelling
trafficonese May 9, 2023
3dda633
remove devtools call
trafficonese May 9, 2023
a7027de
try 3.6.3
trafficonese May 9, 2023
2c4db51
try R 4.0.0
trafficonese May 9, 2023
675bc49
R 3.6
trafficonese May 9, 2023
f4e81d2
R 3.6
trafficonese May 9, 2023
c425fa6
Merge branch 'master' of https://github.com/trafficonese/windfarmGA
trafficonese May 9, 2023
c1ecb1d
R 4.0.0
trafficonese May 9, 2023
137b446
depend R 4.0.5
trafficonese May 9, 2023
6b2eaf8
R 4.1.0
trafficonese May 9, 2023
51c1413
version 4.0, check latest
trafficonese May 9, 2023
4a65bc1
Test terrain for too big polygon
trafficonese May 9, 2023
1e877ab
add tests
trafficonese May 9, 2023
d3207ab
fix tests
trafficonese May 9, 2023
c9f9413
tests
trafficonese May 10, 2023
aeff5c8
simplify fuzzy-control,
trafficonese May 10, 2023
3d673b2
adapt readme
trafficonese May 10, 2023
32323e9
readme
trafficonese May 10, 2023
3c366fd
cleanup, pkgdown
trafficonese May 12, 2023
e334b44
pkgdown
trafficonese May 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
^codemeta\.json$
^data-raw$
^appveyor\.yml$
^CRAN-RELEASE$
^packrat/
^newstuff/
^\.Rprofile$
^.*\.Rproj$
^.RData
^\.Rproj\.user$
^srtm*.*tif
^.gitignore
^.*\.yml$
^.*\.yaml$
^.*\.ini$
^.*\.txt$
^clc_legend.csv$
^srtm*
^srtm*.*hdr
^srtm*.*tfw
^readme.txt
^README.md
^README\.Rmd$
[.](tif|csv|txt|ini|yml|yaml|md|Rmd|grd|hdr|tfw)$
^README-.*\.png$
AUT_msk_alt.gri
AUT_msk_alt.grd
AUT_msk_alt.vrt
g100_06.tif
^.*\.tif
[.](gri|grs|vrt)$
release_to_cran.R
^cclraster$
^docs$
^pkgdown$
^cran-comments\.md$
^_pkgdown\.yaml$
^_experiment$
^revdep$
^\.github$
^CRAN-SUBMISSION$
3 changes: 2 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: '4.1.0'}
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}
Expand Down Expand Up @@ -46,7 +47,7 @@ jobs:
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ docs/*
release_to_cran.R
_experiment
*.RDS
cclraster
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 3.1.0
Date: 2023-04-30 22:13:34 UTC
SHA: 9dc453e9666697de745df759db0a4d19563a2f3d
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
Package: windfarmGA
Title: Genetic Algorithm for Wind Farm Layout Optimization
Version: 3.1.0
Version: 4.0.0
Authors@R: c(
person("Sebastian", "Gatscha", , email="sebastian_gatscha@gmx.at", c("aut", "cre", "cph"))
)
Maintainer: Sebastian Gatscha <sebastian_gatscha@gmx.at>
Description: The genetic algorithm is designed to optimize wind farms of any shape. It requires a predefined amount of turbines, a unified rotor radius and an average wind speed value for each incoming wind direction. A terrain effect model can be included that downloads an 'SRTM' elevation model and loads a Corine Land Cover raster to approximate surface roughness.
Depends:
R (>= 3.2.3)
R (>= 4.1.0)
Imports: Rcpp,
raster,
terra,
sf,
elevatr,
RColorBrewer,
calibrate,
grDevices,
Expand All @@ -33,7 +32,9 @@ Suggests:
doParallel,
progress,
stars,
raster,
leaflet,
elevatr,
ggplot2,
gstat,
rworldmap
Expand Down
63 changes: 29 additions & 34 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

export(barometric_height)
export(calculate_energy)
export(cansee)
export(circle_intersection)
export(crossover)
export(dup_coords)
export(fitness)
export(genetic_algorithm)
export(getDEM)
export(getISO3)
export(get_dist_angles)
export(get_grids)
export(grid_area)
export(hexa_area)
export(init_population)
export(interpol_view)
export(isSpatial)
export(is_doparallel_installed)
export(is_elevatr_installed)
export(is_foreach_installed)
export(is_ggplot2_installed)
export(is_gstat_installed)
export(is_leaflet_installed)
export(is_parallel_installed)
export(mutation)
export(plot_cloud)
export(plot_development)
Expand All @@ -31,19 +35,15 @@ export(plot_windfarmGA)
export(plot_windrose)
export(random_search)
export(random_search_single)
export(rasterprofile)
export(selection)
export(splitAt)
export(terrain_model)
export(trimton)
export(turbine_influences)
export(viewTo)
export(viewshed)
export(windata_format)
export(windfarmGA)
importFrom(RColorBrewer,brewer.pal)
importFrom(Rcpp,sourceCpp)
importFrom(calibrate,textxy)
importFrom(elevatr,get_elev_raster)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,topo.colors)
importFrom(graphics,abline)
Expand All @@ -62,31 +62,7 @@ importFrom(graphics,text)
importFrom(graphics,title)
importFrom(magrittr,"%>%")
importFrom(methods,as)
importFrom(raster,area)
importFrom(raster,calc)
importFrom(raster,cellFromXY)
importFrom(raster,cellStats)
importFrom(raster,crop)
importFrom(raster,crs)
importFrom(raster,extent)
importFrom(raster,extract)
importFrom(raster,getData)
importFrom(raster,intersect)
importFrom(raster,mask)
importFrom(raster,ncell)
importFrom(raster,overlay)
importFrom(raster,plot)
importFrom(raster,projectRaster)
importFrom(raster,projection)
importFrom(raster,raster)
importFrom(raster,rasterToPolygons)
importFrom(raster,rasterize)
importFrom(raster,reclassify)
importFrom(raster,res)
importFrom(raster,resample)
importFrom(raster,terrain)
importFrom(raster,values)
importFrom(raster,wkt)
importFrom(methods,is)
importFrom(sf,`st_crs<-`)
importFrom(sf,sf_extSoftVersion)
importFrom(sf,st_area)
Expand All @@ -111,6 +87,25 @@ importFrom(stats,quantile)
importFrom(stats,runif)
importFrom(stats,sd)
importFrom(stats,smooth.spline)
importFrom(terra,add_legend)
importFrom(terra,app)
importFrom(terra,classify)
importFrom(terra,crop)
importFrom(terra,crs)
importFrom(terra,extract)
importFrom(terra,global)
importFrom(terra,lapp)
importFrom(terra,mosaic)
importFrom(terra,plot)
importFrom(terra,project)
importFrom(terra,rast)
importFrom(terra,res)
importFrom(terra,resample)
importFrom(terra,sprc)
importFrom(terra,terrain)
importFrom(terra,values)
importFrom(terra,viewshed)
importFrom(terra,xyFromCell)
importFrom(utils,download.file)
importFrom(utils,globalVariables)
importFrom(utils,read.csv)
Expand Down
26 changes: 15 additions & 11 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# windfarmGA 3.1.0
* Removed package dependencies on `rgdal` and `rgeos`
* Moved dependencies `foreach`, `parallel`, `doParallel` to Suggests
* Fix `grid_area` and `hexa_area` functions for sf-1.0 and s2
* Fix `getISO3` - only use `sf::st_is_valid` countries from `rworldmap::getMap`
* `projectRaster` seems to require CRS as character and not as CRS object
* supressWarnings for plot-tests
# Updates 4.0.0
- Depends on R 4.1.0
- Removed package dependencies `rgdal` and `rgeos`
- Replaced dependency `raster` with `terra`
- Moved dependencies `foreach`, `parallel`, `doParallel`, `elevatr` to Suggests
- 3D-circle intersection calculation. Especially relevant if the terrain model is activated.
- Fix `grid_area` and `hexa_area` functions for sf-1.0 and s2
- Removed most visibility functions in favor of `terra::viewshed`
- Removed the function `windfarmGA`, as it was redundant and just difficult to test.
- Changed most `cat()` and `print()` calls with `message()`
- Reset old `par` settings

# windfarmGA 3.0.0
* The dependencies `sp`, `spatstat` were removed and replaced by `sf`. All spatial outputs are now **Simple Features**. A Shapefile Polygon can still be passed as input to `genetic_algorithm` / `windfarmGA`, but more underlying functions now require the Polygon to be of type Simple Feature.
Expand Down Expand Up @@ -33,10 +37,10 @@
windfarmGA.cT = 0.88 | Wind Turbine Thrust coefficient
windfarmGA.air_rh = 1.225 | Air Density Value
windfarmGA.k = 0.075 | Wake expansion coefficient. It is assumed to be 0.075 for onshore windfarms and 0.05 for offshore windfarms
windfarmGA.max_angle = 20 | Maximum angle (in degrees) to search for potential influencing turbines
windfarmGA.max_distance = 100000 | Maximum distance (in meters) to search for potential influencing turbines
windfarmGA.max_population = 300 | Maximum amount of individuals per generation
windfarmGA.max_selection = 100 | Maximum amount of selected individuals
windfarmGA.max_angle = 20 | Maximum angle (in degrees) to search for potentially influencing turbines
windfarmGA.max_distance = 100000 | Maximum distance (in meters) to search for potentially influencing turbines
windfarmGA.max_population = 300 | Maximum number of individuals per generation
windfarmGA.max_selection = 100 | Maximum number of selected individuals

# windfarmGA 2.2.2

Expand Down
4 changes: 0 additions & 4 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

wake_CPP <- function(Rotorf, wakr, leA) {
.Call(`_windfarmGA_wake_CPP`, Rotorf, wakr, leA)
}

rotate_CPP <- function(X1, Y1, Px, Py, angle) {
.Call(`_windfarmGA_rotate_CPP`, X1, Y1, Px, Py, angle)
}
Expand Down
6 changes: 3 additions & 3 deletions R/barometric_height.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @export
#'
#' @param data A data.frame containing the height values
#' @param height Column name of the height values
#' @param height Column name of the height values
#' @param po Standardized air pressure at sea level (101325 Pa)
#' @param ro Standardized air density at sea level (1,225 kg per m3)
#'
Expand All @@ -17,11 +17,11 @@
#' air pressures, air densities and temperatures in Kelvin and Celsius.
#'
#' @examples
#' data <- matrix(seq(0,5000,500));
#' data <- matrix(seq(0, 5000, 500))
#' barometric_height(data)
#' plot.ts(barometric_height(data))
barometric_height <- function(data, height, po = 101325, ro = 1.225) {
if ( is.numeric(data) || (ncol(data)) == 1 ) {
if (is.numeric(data) || (ncol(data)) == 1) {
## Luftdruck auf Hoehe h berechnen
ph <- as.numeric(po * exp(-data * 0.0001252))
## Luftdichte berechnen
Expand Down
Loading