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
OpenBuildingMap
rabotnik-obm
Commits
d9443876
Commit
d9443876
authored
Aug 09, 2021
by
Marius Kriegerowski
Browse files
Renamed TaxonomyMapper
parent
296a66d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
rabotnikobm/taxonomy/gem_taxonomy.py
View file @
d9443876
...
...
@@ -40,7 +40,7 @@ def read_csv(fn: str) -> list[dict[str, str]]:
return
taxonomy_reader
class
TaxonomyMapper
:
class
Taxonomy
Occupancy
Mapper
:
"""Map building tags to `GEM_taxonomy_occupancy`"""
...
...
@@ -68,7 +68,7 @@ class TaxonomyMapper:
@
classmethod
def
from_csv
(
cls
,
fn
:
str
):
"""Read a csv and initialize a `TaxonomyMapper`."""
"""Read a csv and initialize a `Taxonomy
Occupancy
Mapper`."""
taxonomy
=
read_csv
(
fn
)
grouped_taxonomy
=
group_taxonomy
(
taxonomy
)
...
...
tests/test_gem_taxonomy.py
View file @
d9443876
...
...
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
from
rabotnikobm.taxonomy.gem_taxonomy
import
group_taxonomy
,
TaxonomyMapper
from
rabotnikobm.taxonomy.gem_taxonomy
import
group_taxonomy
,
Taxonomy
Occupancy
Mapper
def
test_group_taxonomy
():
...
...
@@ -32,13 +32,13 @@ def test_group_taxonomy():
def
test_mapper_from_csv
(
pytestconfig
):
demo_file
=
pytestconfig
.
rootpath
/
"data/rules/occupancy/building_and_PoIs_tags.csv"
mapper
=
TaxonomyMapper
.
from_csv
(
demo_file
)
mapper
=
Taxonomy
Occupancy
Mapper
.
from_csv
(
demo_file
)
assert
mapper
def
test_taxonomy_mapper_building_pois
(
pytestconfig
):
demo_file
=
pytestconfig
.
rootpath
/
"data/rules/occupancy/building_and_PoIs_tags.csv"
mapper
=
TaxonomyMapper
.
from_csv
(
demo_file
)
mapper
=
Taxonomy
Occupancy
Mapper
.
from_csv
(
demo_file
)
sample_tags
=
[{
"amenity"
:
"community_centre"
},
{
"amenity"
:
"cafe"
},
{
"x"
:
"y"
}]
...
...
@@ -47,7 +47,7 @@ def test_taxonomy_mapper_building_pois(pytestconfig):
def
test_taxonomy_mapper_landuse
(
pytestconfig
):
demo_file
=
pytestconfig
.
rootpath
/
"data/rules/occupancy/landuse_tags.csv"
mapper
=
TaxonomyMapper
.
from_csv
(
demo_file
)
mapper
=
Taxonomy
Occupancy
Mapper
.
from_csv
(
demo_file
)
sample_tags
=
[{
"amenity"
:
"university"
,
"a"
:
"b"
},
{
"landuse"
:
"brownfield"
},
{
"x"
:
"y"
}]
...
...
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