Skip to content

Commit

Permalink
Merge pull request #35 from trafficonese/master
Browse files Browse the repository at this point in the history
v 4.0.0
  • Loading branch information
trafficonese authored Mar 11, 2024
2 parents 6fc1ab9 + e334b44 commit bc5a559
Show file tree
Hide file tree
Showing 98 changed files with 4,729 additions and 5,131 deletions.
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

0 comments on commit bc5a559

Please sign in to comment.