orbisgis / geoclimate

Geospatial processing toolbox for environmental and climate studies
GNU Lesser General Public License v3.0
59 stars 16 forks source link

Error calculating indicators in "only sea" areas #840

Closed j3r3m1 closed 11 months ago

j3r3m1 commented 12 months ago

When GeoClimate is applied on areas where only sea is present, the following error happens. I start to work on that to create a unit test to see how to pass this when necessary.

The OSM workflow has been started. Please wait... 17:42:59.137 [main] INFO org.orbisgis.geoclimate.osm.OSM - 1 osm areas will be processed 17:43:00.339 [main] INFO org.orbisgis.geoclimate.osmtools.OSMTools - Extract the OSM data 17:43:03.257 [main] INFO org.orbisgis.geoclimate.osmtools.OSMTools - Downloading the OSM data from overpass api in /tmp/f31f5a16798717f0a15182beb8af61c4b8e31bc9ab71fa3142d60a3ed56f8c02.osm 17:43:03.262 [main] INFO org.orbisgis.geoclimate.osmtools.OSMTools - The OSM file has been downloaded at /tmp/f31f5a16798717f0a15182beb8af61c4b8e31bc9ab71fa3142d60a3ed56f8c02.osm. 17:43:03.323 [main] INFO org.orbisgis.geoclimate.osmtools.OSMTools - Load the OSM file in the database. 17:43:03.384 [main] INFO org.orbisgis.geoclimate.osmtools.OSMTools - The input OSM file has been loaded in the database. 17:43:03.533 [main] INFO org.orbisgis.geoclimate.osm.OSM - Building layer created 17:43:03.542 [main] INFO org.orbisgis.geoclimate.osm.OSM - Road layer created 17:43:03.551 [main] INFO org.orbisgis.geoclimate.osm.OSM - Rail layer created 17:43:03.584 [main] INFO org.orbisgis.geoclimate.osm.OSM - Vegetation layer created 17:43:03.602 [main] INFO org.orbisgis.geoclimate.osm.OSM - Water layer created 17:43:03.619 [main] INFO org.orbisgis.geoclimate.osm.OSM - Impervious layer created 17:43:03.636 [main] INFO org.orbisgis.geoclimate.osm.OSM - Urban areas layer created 17:43:03.660 [main] INFO org.orbisgis.geoclimate.osm.OSM - Coastline layer created 17:43:03.776 [main] INFO org.orbisgis.geoclimate.Geoindicators - Create the units of analysis... 17:43:04.211 [main] INFO org.orbisgis.geoclimate.Geoindicators - Start computing the geoindicators... 17:43:04.212 [main] INFO org.orbisgis.geoclimate.Geoindicators - Start computing building indicators... 17:43:04.362 [main] INFO org.orbisgis.geoclimate.Geoindicators - Start computing RSU indicators... 17:43:04.421 [main] ERROR org.orbisgis.data.jdbc.JdbcDataSource - Unable to create an index on the column 'id_rsu' in the table 'rsu_indicator_RSU_SMALLEST_COMMUN_GEOMETRY'. Table "RSU_INDICATOR_RSU_SMALLEST_COMMUN_GEOMETRY" not found; SQL statement: CREATE INDEX IF NOT EXISTS RSU_INDICATOR_RSU_SMALLEST_COMMUN_GEOMETRY_id_rsu ON RSU_INDICATOR_RSU_SMALLEST_COMMUN_GEOMETRY (ID_RSU) [42102-214] org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "RSU_INDICATOR_RSU_SMALLEST_COMMUN_GEOMETRY" not found; SQL statement: CREATE TABLE without_undefined_2720d627_efa2_4d8f_8e50_c1bc4f456a5e AS SELECT b.id_rsu , COALESCE(SUM(CASE WHEN a.high_vegetation =1 AND a.rail =0 AND a.road =0 AND a.water =0 AND a.low_vegetation =0 AND a.impervious =0 AND a.building =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS high_vegetation_fraction , COALESCE(SUM(CASE WHEN a.high_vegetation =1 AND a.water =1 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS high_vegetation_water_fraction , COALESCE(SUM(CASE WHEN a.high_vegetation =1 AND a.building =1 AND a.water =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS high_vegetation_building_fraction , COALESCE(SUM(CASE WHEN a.high_vegetation =1 AND a.low_vegetation =1 AND a.water=0 AND a.building =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS high_vegetation_low_vegetation_fraction , COALESCE(SUM(CASE WHEN a.high_vegetation =1 AND a.rail =1 AND a.water=0 AND a.building=0 AND a.low_vegetation =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS high_vegetation_rail_fraction , COALESCE(SUM(CASE WHEN a.high_vegetation =1 AND a.road =1 AND a.water=0 AND a.building=0 AND a.low_vegetation=0 AND a.rail =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS high_vegetation_road_fraction , COALESCE(SUM(CASE WHEN a.high_vegetation =1 AND a.impervious =1 AND a.water=0 AND a.building=0 AND a.low_vegetation=0 AND a.rail=0 AND a.road =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS high_vegetation_impervious_fraction , COALESCE(SUM(CASE WHEN a.water =1 AND a.high_vegetation =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS water_fraction , COALESCE(SUM(CASE WHEN a.building =1 AND a.water =0 AND a.high_vegetation =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS building_fraction , COALESCE(SUM(CASE WHEN a.low_vegetation =1 AND a.water=0 AND a.building=0 AND a.high_vegetation =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS low_vegetation_fraction , COALESCE(SUM(CASE WHEN a.rail =1 AND a.water=0 AND a.building=0 AND a.high_vegetation=0 AND a.low_vegetation =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS rail_fraction , COALESCE(SUM(CASE WHEN a.road =1 AND a.water=0 AND a.building=0 AND a.high_vegetation=0 AND a.low_vegetation=0 AND a.rail =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS road_fraction , COALESCE(SUM(CASE WHEN a.impervious =1 AND a.water=0 AND a.building=0 AND a.high_vegetation=0 AND a.low_vegetation=0 AND a.rail=0 AND a.road =0 THEN a.area ELSE 0 END),0)/st_area(b.the_geom) AS impervious_fraction FROM rsu_indicator_RSU_SMALLEST_COMMUN_GEOMETRY AS a RIGHT JOIN rsu b ON a.id_rsu=b.id_rsu GROUP BY b.id_rsu; [42102-214] at org.h2.message.DbException.getJdbcSQLException(DbException.java:502) at org.h2.message.DbException.getJdbcSQLException(DbException.java:477) at org.h2.message.DbException.get(DbException.java:223) at org.h2.message.DbException.get(DbException.java:199) at org.h2.command.Parser.getTableOrViewNotFoundDbException(Parser.java:8398) at org.h2.command.Parser.getTableOrViewNotFoundDbException(Parser.java:8369) at org.h2.command.Parser.readTableOrView(Parser.java:8358) at org.h2.command.Parser.readTablePrimary(Parser.java:1863) at org.h2.command.Parser.readTableReference(Parser.java:2334) at org.h2.command.Parser.parseSelectFromPart(Parser.java:2772) at org.h2.command.Parser.parseSelect(Parser.java:2878) at org.h2.command.Parser.parseQueryPrimary(Parser.java:2762) at org.h2.command.Parser.parseQueryTerm(Parser.java:2633) at org.h2.command.Parser.parseQueryExpressionBody(Parser.java:2612) at org.h2.command.Parser.parseQueryExpressionBodyAndEndOfQuery(Parser.java:2605) at org.h2.command.Parser.parseQueryExpression(Parser.java:2598) at org.h2.command.Parser.parseQuery(Parser.java:2567) at org.h2.command.Parser.parseCreateTable(Parser.java:9310) at org.h2.command.Parser.parseCreate(Parser.java:6784) at org.h2.command.Parser.parsePrepared(Parser.java:763) at org.h2.command.Parser.parse(Parser.java:689) at org.h2.command.Parser.parse(Parser.java:661) at org.h2.command.Parser.prepareCommand(Parser.java:569) at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:631) at org.h2.command.CommandList.executeRemaining(CommandList.java:53) at org.h2.command.CommandList.update(CommandList.java:66) at org.h2.command.Command.executeUpdate(Command.java:252) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:209) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:169) at org.h2.jdbc.JdbcCallableStatement.executeUpdate(JdbcCallableStatement.java:96) at groovy.sql.Sql.call(Sql.java:3068) at groovy.sql.Sql.call(Sql.java:3014) at groovy.sql.Sql$call$0.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139) at org.orbisgis.geoclimate.geoindicators.RsuIndicators.surfaceFractions(RsuIndicators.groovy:1597) at org.orbisgis.geoclimate.geoindicators.RsuIndicators$surfaceFractions$0.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.orbisgis.geoclimate.geoindicators.WorkflowGeoIndicators.computeRSUIndicators(WorkflowGeoIndicators.groovy:458) at org.orbisgis.geoclimate.geoindicators.WorkflowGeoIndicators$computeRSUIndicators$2.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171) at org.orbisgis.geoclimate.geoindicators.WorkflowGeoIndicators.computeGeoclimateIndicators(WorkflowGeoIndicators.groovy:1529) at org.orbisgis.geoclimate.geoindicators.WorkflowGeoIndicators$computeGeoclimateIndicators$0.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171) at org.orbisgis.geoclimate.geoindicators.WorkflowGeoIndicators.computeAllGeoIndicators(WorkflowGeoIndicators.groovy:1334) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrap.invoke(PogoMetaMethodSite.java:182) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.orbisgis.geoclimate.osm.WorkflowOSM$_osm_processing_closure2.doCall(WorkflowOSM.groovy:530) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035) at groovy.lang.Closure.call(Closure.java:412) at groovy.lang.Closure.call(Closure.java:428) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2359) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2344) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2397) at org.codehaus.groovy.runtime.dgm$204.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:247) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139) at org.orbisgis.geoclimate.osm.WorkflowOSM.osm_processing(WorkflowOSM.groovy:412) at org.orbisgis.geoclimate.osm.WorkflowOSM$osm_processing$1.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171) at org.orbisgis.geoclimate.osm.WorkflowOSM.workflow(WorkflowOSM.groovy:361) at org.orbisgis.geoclimate.osm.WorkflowOSM$workflow.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139) at org.orbisgis.geoclimate.Geoclimate.call(Geoclimate.groovy:93) at org.orbisgis.geoclimate.Geoclimate.call(Geoclimate.groovy) at picocli.CommandLine.executeUserObject(CommandLine.java:1953) at picocli.CommandLine.access$1300(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358) at picocli.CommandLine$RunLast.handle(CommandLine.java:2352) at picocli.CommandLine$RunLast.handle(CommandLine.java:2314) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179) at picocli.CommandLine$RunLast.execute(CommandLine.java:2316) at picocli.CommandLine.execute(CommandLine.java:2078) at picocli.CommandLine$execute.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139) at org.orbisgis.geoclimate.Geoclimate.main(Geoclimate.groovy:133)

j3r3m1 commented 11 months ago

@wurtzj is the new GeoClimate version solves this issue ?

wurtzj commented 11 months ago

Yes it works