Skip to content

Commit

Permalink
Merge pull request #898 from ebocher/prepare_release_0_2_0
Browse files Browse the repository at this point in the history
Prepare geoclimate 0.0.2 release
  • Loading branch information
ebocher authored Jan 9, 2024
2 parents 870015f + 0f52bd4 commit a418f00
Show file tree
Hide file tree
Showing 26 changed files with 258 additions and 267 deletions.
13 changes: 3 additions & 10 deletions bdtopo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@
<artifactId>bdtopo</artifactId>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy-version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-json</artifactId>
<version>${groovy-version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-sql</artifactId>
<version>${groovy-version}</version>
</dependency>
<dependency>
<groupId>org.orbisgis.data</groupId>
Expand All @@ -55,10 +52,6 @@
<groupId>org.orbisgis.geoclimate</groupId>
<artifactId>common-utils</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import org.orbisgis.geoclimate.utils.AbstractScript
abstract class BDTopoUtils extends AbstractScript {

BDTopoUtils() {
super(BDTopoUtils.class)
}

/**
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions common-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@

<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
/**
* GeoClimate is a geospatial processing toolbox for environmental and climate studies
* <a href="https://github.com/orbisgis/geoclimate">https://github.com/orbisgis/geoclimate</a>.
*
* This code is part of the GeoClimate project. GeoClimate is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* Lesser General Public License as published by the Free Software Foundation;
* version 3.0 of the License.
*
* GeoClimate is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details <http://www.gnu.org/licenses/>.
*
*
* For more information, please consult:
* <a href="https://github.com/orbisgis/geoclimate">https://github.com/orbisgis/geoclimate</a>
*
*/
package org.orbisgis.geoclimate.utils

import org.slf4j.Logger

abstract class AbstractScript extends Script {


public Logger logger


AbstractScript(Class aClass) {
this.logger = org.slf4j.LoggerFactory.getLogger(aClass.toString())
AbstractScript() {
}


static String uuid() { UUID.randomUUID().toString().replaceAll("-", "_") }

void info(def message) {
logger.info( message.toString())
LoggerUtils.info( message.toString())
}

void warn(def message) {
logger.warn(message.toString())
LoggerUtils.warn(message.toString())
}

void error(def message) {
logger.error(message.toString())
LoggerUtils.error(message.toString())
}

void debug(def message) {
logger.debug(message.toString())
LoggerUtils.debug(message.toString())
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,74 @@ package org.orbisgis.geoclimate.utils

import ch.qos.logback.classic.Level
import ch.qos.logback.classic.LoggerContext
import org.slf4j.Logger
import org.slf4j.LoggerFactory


/**
* GeoClimate is a geospatial processing toolbox for environmental and climate studies
* <a href="https://github.com/orbisgis/geoclimate">https://github.com/orbisgis/geoclimate</a>.
*
* This code is part of the GeoClimate project. GeoClimate is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* Lesser General Public License as published by the Free Software Foundation;
* version 3.0 of the License.
*
* GeoClimate is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details <http://www.gnu.org/licenses/>.
*
*
* For more information, please consult:
* <a href="https://github.com/orbisgis/geoclimate">https://github.com/orbisgis/geoclimate</a>
*
*/
class LoggerUtils {

static Logger logger

static LOGLEVEL_KEY="org.orbisgis.geoclimate.loglevel"

private LoggerUtils() throws IOException{
String level = System.getProperty(LOGLEVEL_KEY)
if(level){
setLoggerLevel(level)
}else{
setLoggerLevel("info")
}
logger =org.slf4j.LoggerFactory.getLogger("GeoClimate")
}

private static Logger getLogger(){
if(logger == null){
try {
new LoggerUtils()
} catch (IOException e) {
e.printStackTrace()
}
}
return logger
}

static info(def message) {
getLogger().info( message.toString())
}

static warn(def message) {
getLogger().warn(message.toString())
}

static error(def message) {
getLogger().error(message.toString())
}

static debug(def message) {
getLogger().debug(message.toString())
}

static trace(def message) {
getLogger().trace(message.toString())
}

/**
* Utility class to change log level for all loggers
Expand Down
15 changes: 3 additions & 12 deletions geoclimate/pom.xml → geoclimate-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-json</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-sql</artifactId>
</dependency>
<dependency>
Expand Down Expand Up @@ -85,15 +85,6 @@
<groupId>org.orbisgis.geoclimate</groupId>
<artifactId>osmtools</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-version}</version>
</dependency>

<!-- Test dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ class Geoclimate implements Callable<Integer> {
@Override
Integer call() {
if (verbose) {
LoggerUtils.setLoggerLevel(verbose.trim())
System.setProperty(LoggerUtils.LOGLEVEL_KEY, verbose.trim())
} else {
LoggerUtils.setLoggerLevel("INFO")
System.setProperty(LoggerUtils.LOGLEVEL_KEY, "INFO")
}
if (workflow.trim().equalsIgnoreCase("OSM")) {
println("The OSM workflow has been started.\nPlease wait...")
Expand Down
14 changes: 3 additions & 11 deletions geoindicators/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy-version}</version>
</dependency>
<dependency>
<groupId>org.orbisgis.data</groupId>
Expand Down Expand Up @@ -55,23 +54,17 @@
<version>1.4.19</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-json</artifactId>
<version>${groovy-version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-sql</artifactId>
<version>${groovy-version}</version>
</dependency>
<dependency>
<groupId>org.orbisgis.geoclimate</groupId>
<artifactId>common-utils</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
Expand All @@ -85,7 +78,6 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import org.orbisgis.geoclimate.utils.AbstractScript
abstract class Geoindicators extends AbstractScript {

Geoindicators() {
super(Geoindicators.class)
}

//Processes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.io.TempDir
import org.orbisgis.data.H2GIS
import org.orbisgis.geoclimate.Geoindicators
import org.orbisgis.geoclimate.utils.LoggerUtils

import static org.junit.jupiter.api.Assertions.assertNotNull
import static org.junit.jupiter.api.Assertions.assertTrue
Expand All @@ -43,11 +44,11 @@ class NoiseIndicatorsTests {

@Test
void groundAcousticLayer() {
h2GIS.load(SpatialUnitsTests.class.getResource("road_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("building_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("veget_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("hydro_test.geojson"), true)
def zone = h2GIS.load(SpatialUnitsTests.class.getResource("zone_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("road_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("building_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("veget_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("hydro_test.geojson"), true)
def zone = h2GIS.load(SpatialUnitsTests.getResource("zone_test.geojson"), true)

def env = h2GIS.getSpatialTable(zone).getExtent()
if (env) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,11 @@ class RsuIndicatorsTests {

@Test
void smallestCommunGeometryTest() {
h2GIS.load(SpatialUnitsTests.class.getResource("road_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("building_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("veget_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("hydro_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("zone_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("road_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("building_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("veget_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("hydro_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("zone_test.geojson"), true)

def outputTableGeoms = Geoindicators.SpatialUnits.prepareTSUData(h2GIS,
'zone_test', 'road_test', '',
Expand Down Expand Up @@ -751,11 +751,11 @@ class RsuIndicatorsTests {

@Test
void groundLayer() {
h2GIS.load(SpatialUnitsTests.class.getResource("road_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("building_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("veget_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.getResource("hydro_test.geojson"), true)
def zone = h2GIS.load(SpatialUnitsTests.class.getResource("zone_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("road_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("building_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("veget_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("hydro_test.geojson"), true)
def zone = h2GIS.load(SpatialUnitsTests.getResource("zone_test.geojson"), true)

def env = h2GIS.getSpatialTable(zone).getExtent()
if (env) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ import org.junit.jupiter.api.io.TempDir
import org.locationtech.jts.io.WKTReader
import org.orbisgis.data.POSTGIS
import org.orbisgis.geoclimate.Geoindicators

import static org.junit.jupiter.api.Assertions.assertEquals
import static org.junit.jupiter.api.Assertions.assertNotNull
import static org.orbisgis.data.H2GIS.open
import org.orbisgis.data.H2GIS

class SpatialUnitsTests {

Expand All @@ -44,11 +43,11 @@ class SpatialUnitsTests {
]
static POSTGIS postGIS;

private static def h2GIS
private static H2GIS h2GIS

@BeforeAll
static void beforeAll() {
h2GIS = open(folder.getAbsolutePath() + File.separator + "spatialUnitsTests;AUTO_SERVER=TRUE")
h2GIS = H2GIS.open(folder.getAbsolutePath() + File.separator + "spatialUnitsTests;AUTO_SERVER=TRUE")
postGIS = POSTGIS.open(dbProperties)
System.setProperty("test.postgis", Boolean.toString(postGIS != null));
}
Expand Down Expand Up @@ -180,11 +179,11 @@ class SpatialUnitsTests {

@Test
void prepareGeometriesForRSUWithFilterTest() {
h2GIS.load(SpatialUnitsTests.class.class.getResource("road_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.class.getResource("rail_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.class.getResource("veget_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.class.getResource("hydro_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.class.class.getResource("zone_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("road_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("rail_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("veget_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("hydro_test.geojson"), true)
h2GIS.load(SpatialUnitsTests.getResource("zone_test.geojson"), true)

def outputTableGeoms = Geoindicators.SpatialUnits.prepareTSUData(h2GIS,
'zone_test', 'road_test', 'rail_test', 'veget_test',
Expand Down
Loading

0 comments on commit a418f00

Please sign in to comment.