Skip to content

Commit

Permalink
Merge pull request #154 from TitouanRobert/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
TitouanRobert authored Dec 7, 2017
2 parents 8efddea + 4ddfe39 commit dea4398
Show file tree
Hide file tree
Showing 98 changed files with 8,083 additions and 1,651 deletions.
20 changes: 19 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,31 @@ dist: trusty
sudo: required
cache: packages

before_install:
sudo apt-get install -y libprotobuf-dev protobuf-compiler

r: bioc-devel

r_github_packages:
- hadley/devtools#1263
- Bioconductor-mirror/zlibbioc
- Bioconductor-mirror/rhdf5
- rte-antares-rpackage/manipulateWidget@develop
- rte-antares-rpackage/antaresMaps
- rte-antares-rpackage/antaresRead@develop
- rte-antares-rpackage/antaresProcessing@develop

addons:
apt:
sources:
- sourceline: 'ppa:opencpu/jq'
packages:
- libjq-dev
- valgrind
- libgdal-dev
- libproj-dev
- libv8-3.14-dev

include:
- r: release
- r: oldrel
Expand Down
103 changes: 55 additions & 48 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,48 +1,55 @@
Package: antaresViz
Type: Package
Title: Antares Visualizations
Version: 0.11.1
Date: 2017-07-17
Authors@R: c(
person("Francois", "Guillem", , "[email protected]", role = c("aut", "cre")),
person("Jalal-Edine", "ZAWAM", , "[email protected]", role = "ctb"),
person("RTE", role = "cph")
)
Maintainer: Francois Guillem <[email protected]>
Description: Visualize results generated by Antares, a powerful software
developed by RTE to simulate and study electric power systems
(more information about Antares here: <https://antares.rte-france.com>).
This package provides functions that create interactive charts to help
Antares users visually explore the results of their simulations.
URL: https://github.com/rte-antares-rpackage/antaresViz
BugReports: https://github.com/rte-antares-rpackage/antaresViz/issues
License: GPL (>= 2) | file LICENSE
LazyData: TRUE
Encoding: UTF-8
Depends:
antaresRead (>= 0.14.0),
antaresProcessing (>= 0.11.0)
Imports:
dygraphs (>= 1.1.1),
shiny (>= 0.13.0),
miniUI,
magrittr,
plotly (>= 4.5.6),
tibble,
htmltools,
htmlwidgets (>= 0.7.0),
manipulateWidget (>= 0.7.0),
leaflet (>= 1.1.0),
sp,
webshot,
data.table,
methods,
lubridate,
geojsonio,
graphics,
stats,
leaflet.minicharts (>= 0.5.0)
RoxygenNote: 6.0.1
Suggests: testthat,
covr

Package: antaresViz
Type: Package
Title: Antares Visualizations
Version: 0.11.3
Date: 2017-12-07
Authors@R: c(
person("Jalal-Edine", "ZAWAM", , "[email protected]", role = c("aut", "cre")),
person("Francois", "Guillem", , "[email protected]", role = "aut"),
person("Benoit", "Thieurmel", email = "[email protected]", role = "aut"),
person(given = "Titouan", family = "Robert", email = "[email protected]", role = "aut"),
person("Baptiste", "SEGUINOT", , "[email protected]", role = "ctb"),
person("RTE", role = "cph")
)
Maintainer: Jalal-Edine ZAWAM <[email protected]>
Description: Visualize results generated by Antares, a powerful software
developed by RTE to simulate and study electric power systems
(more information about Antares here: <https://antares.rte-france.com>).
This package provides functions that create interactive charts to help
Antares users visually explore the results of their simulations.
URL: https://github.com/rte-antares-rpackage/antaresViz
BugReports: https://github.com/rte-antares-rpackage/antaresViz/issues
License: GPL (>= 2) | file LICENSE
LazyData: TRUE
Encoding: UTF-8
Depends:
antaresRead (>= 2.0.0),
antaresProcessing (>= 0.12.0),
spMaps (>= 0.1)
Imports:
dygraphs (>= 1.1.1),
shiny (>= 0.13.0),
magrittr,
plotly (>= 4.5.6),
htmltools,
htmlwidgets (>= 0.7.0),
manipulateWidget (>= 0.8.0),
leaflet (>= 1.1.0),
sp,
webshot,
data.table,
methods,
lubridate,
geojsonio,
graphics,
stats,
leaflet.minicharts (>= 0.5.2),
assertthat
RoxygenNote: 6.0.1
Suggests: testthat,
covr,
rhdf5 (>= 2.20.2),
rbokeh,
knitr,
visNetwork
VignetteBuilder: knitr
21 changes: 20 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,47 +1,66 @@
# Generated by roxygen2: do not edit by hand

S3method(plot,antaresData)
S3method(plot,list)
S3method(plot,mapLayout)
S3method(plot,simOptions)
export(addShadows)
export(colorScaleOptions)
export(defaultTilesURL)
export(exchangesStack)
export(getInteractivity)
export(leafletDragPointsOutput)
export(limitSizeGraph)
export(mapLayout)
export(modRpart)
export(modXY)
export(plotMap)
export(plotMapLayout)
export(plotMapOptions)
export(plotThermalGroupCapacities)
export(plotXY)
export(prodStack)
export(prodStackAliases)
export(prodStackLegend)
export(renderLeafletDragPoints)
export(runAppAntaresViz)
export(savePlotAsPng)
export(setInteractivity)
export(setProdStackAlias)
export(stackMap)
export(tsLegend)
export(tsPlot)
import(antaresProcessing)
import(antaresRead)
import(assertthat)
import(data.table)
import(dygraphs)
import(htmltools)
import(leaflet)
import(leaflet.minicharts)
import(manipulateWidget)
import(miniUI)
import(shiny)
import(spMaps)
importFrom(grDevices,col2rgb)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,colors)
importFrom(grDevices,gray)
importFrom(grDevices,rainbow)
importFrom(grDevices,rgb)
importFrom(graphics,par)
importFrom(graphics,plot)
importFrom(methods,is)
importFrom(plotly,add_bars)
importFrom(plotly,add_heatmap)
importFrom(plotly,add_text)
importFrom(plotly,add_trace)
importFrom(plotly,config)
importFrom(plotly,layout)
importFrom(plotly,plot_ly)
importFrom(shiny,runApp)
importFrom(stats,as.formula)
importFrom(stats,density)
importFrom(stats,lm)
importFrom(stats,predict)
importFrom(stats,quantile)
importFrom(utils,object.size)
161 changes: 161 additions & 0 deletions R/api_info.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
.giveH5DataToApi <- function(sharerequest, infos, areas = NULL, links = NULL, clusters = NULL, districts = NULL){
if(infos$isH5){
gc()
if(length(sharerequest$mcYearh_l)==0) {mcYearh2 <- NULL}else{
if("all"%in%sharerequest$mcYearh_l){
mcYearh2 <- "all"
}else{
mcYearh2 <- as.numeric(sharerequest$mcYearh_l)
}
}
if(!is.null(sharerequest$tables_l))
{
if("areas" %in% sharerequest$tables_l){
areas <- "all"
}
if("links" %in% sharerequest$tables_l){
links <- "all"
}
if("clusters" %in% sharerequest$tables_l){
clusters <- "all"
}
if("districts" %in% sharerequest$tables_l){
districts <- "all"
}
}
readAntares(areas = areas, links = links, clusters = clusters,districts = districts , mcYears = mcYearh2,
timeStep = sharerequest$timeSteph5_l, opts = infos$dataInput)
}else{
infos$dataInput
}
}








.giveDateInfos <- function(yD, params, xyCompare, minMax, tabl = NULL){
use <- NULL
nulTab <- is.null(tabl)
if(!is.null(params))
{
if(minMax == "min")
{
if(is.null(yD)){
if(!nulTab)
{
use <- params$x[[1]][[tabl]]$dataDateRange[1]
}
else{
use <- params$x[[1]]$dataDateRange[1]
}
}else if(xyCompare == "union"){
use <- min(
do.call("c",(lapply(params$x, function(vv){
if(nulTab){
unique(vv$dataDateRange[1])
}else{
vv[[tabl]]$dataDateRange[1]
}
}
))))
} else if(xyCompare == "intersect"){
use <- max(
do.call("c",(lapply(params$x, function(vv){
if(nulTab){
unique(vv$dataDateRange[1])
}else{
vv[[tabl]]$dataDateRange[1]
}
}
))))
}
}
if(minMax == "max")
{
if(is.null(yD)){
if(!nulTab)
{
use <- params$x[[1]][[tabl]]$dataDateRange[2]
}
else{
use <- params$x[[1]]$dataDateRange[2]
}
}else if(xyCompare == "union"){
use <- max(
do.call("c",(lapply(params$x, function(vv){
if(nulTab){
unique(vv$dataDateRange[2])
}else{
vv[[tabl]]$dataDateRange[2]
}
}
))))
} else if(xyCompare == "intersect"){
use <- min(
do.call("c",(lapply(params$x, function(vv){
if(nulTab){
unique(vv$dataDateRange[2])
}else{
vv[[tabl]]$dataDateRange[2]
}
}
))))
}
}}
use
}

.giveParamH5 <- function(X_I, Y_I, xyCompare){
if(X_I$isH5){
opts <- X_I$dataInput
fid <- rhdf5::H5Fopen(opts$h5path)
timeStepS <- .getTimeStep(fid)
timeStepS <- as.character(timeStepS)
mcYearS <- opts$mcYears
tabl <- .getTableInH5(fid, timeStepS[1])
rhdf5::H5Fclose(fid)
xPart = list(
timeStepS = timeStepS,
mcYearS = mcYearS,
tabl = tabl
)

}else{
xPart = NULL
}
if(Y_I$isH5){
opts <- Y_I$dataInput
fid <- rhdf5::H5Fopen(opts$h5path)
timeStepS <- .getTimeStep(fid)
timeStepS <- as.character(timeStepS)
mcYearS <- opts$mcYears
tabl <- .getTableInH5(fid, timeStepS[1])
tabl <- tabl[tabl%in%c("areas", "districts")]
rhdf5::H5Fclose(fid)
yPart = list(
timeStepS = timeStepS,
mcYearS = mcYearS,
tabl = tabl
)
}else{
yPart = NULL
}
if(is.null(xPart) & is.null(yPart)){
ret <- NULL
}else if(is.null(xPart)){
ret <- yPart
}else if(is.null(yPart)){
ret <- xPart
}else{
ret <- list()
ret$timeStepS <- .compareOperation(list(xPart$timeStepS, yPart$timeStepS), xyCompare)
ret$mcYearS <- sort(.compareOperation(list(xPart$mcYearS, yPart$mcYearS), xyCompare))
ret$tabl <- .compareOperation(list(xPart$tabl, yPart$tabl), xyCompare)
}
rhdf5::H5close()
ret
}
Loading

0 comments on commit dea4398

Please sign in to comment.