Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dynamic Exposure
Global Dynamic Exposure
gde-core
Commits
0e1610dd
Commit
0e1610dd
authored
Jul 27, 2022
by
Cecilia Nievas
Browse files
Forced ignoring Pandas warning for non-SQLAlchemy Connection
parent
aaa543c8
Pipeline
#46813
passed with stage
in 1 minute and 39 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
gdecore/database_queries.py
View file @
0e1610dd
...
...
@@ -21,6 +21,7 @@ import numpy
import
shapely
import
pandas
import
geopandas
import
warnings
from
gdeimporter.tools.database
import
Database
...
...
@@ -390,12 +391,17 @@ class DatabaseQueries:
db_obm_buildings
=
Database
(
**
db_obm_buildings_config
)
db_obm_buildings
.
create_connection_and_cursor
()
obm_buildings
=
geopandas
.
GeoDataFrame
.
from_postgis
(
sql_query
%
(
db_table
,
"4326"
,
geographic_area
,
occupancy_types_condition
),
db_obm_buildings
.
connection
,
geom_col
=
"geometry"
,
crs
=
"epsg:4326"
,
)
with
warnings
.
catch_warnings
():
# Ignore warning for non-SQLAlchemy Connection
# (see github.com/pandas-dev/pandas/issues/45660)
warnings
.
simplefilter
(
"ignore"
,
UserWarning
)
obm_buildings
=
geopandas
.
GeoDataFrame
.
from_postgis
(
sql_query
%
(
db_table
,
"4326"
,
geographic_area
,
occupancy_types_condition
),
db_obm_buildings
.
connection
,
geom_col
=
"geometry"
,
crs
=
"epsg:4326"
,
)
db_obm_buildings
.
close_connection
()
...
...
tests/data/exposure_entities.txt
View file @
0e1610dd
Spain
Turkey
Switzerland
Germany
\ No newline at end of file
tests/test_configuration.py
View file @
0e1610dd
...
...
@@ -100,7 +100,7 @@ def test_Configuration_interpret_exposure_entities_to_run(test_db):
returned_config
.
interpret_exposure_entities_to_run
()
assert
len
(
returned_config
.
exposure_entities_to_run
)
==
3
assert
returned_config
.
exposure_entities_to_run
[
0
]
==
"ESP"
assert
returned_config
.
exposure_entities_to_run
[
1
]
==
"
TUR
"
assert
returned_config
.
exposure_entities_to_run
[
1
]
==
"
CHE
"
assert
returned_config
.
exposure_entities_to_run
[
2
]
==
"DEU"
# A name of a CSV file is provided, 'exposure_entities_code' is ISO3
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment