geometamaker 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {geometamaker-0.1.0 → geometamaker-0.1.2}/.github/workflows/test.yml +1 -1
- geometamaker-0.1.2/HISTORY.rst +23 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/PKG-INFO +14 -2
- {geometamaker-0.1.0 → geometamaker-0.1.2}/pyproject.toml +5 -1
- {geometamaker-0.1.0 → geometamaker-0.1.2}/requirements.txt +2 -2
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker/cli.py +1 -1
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker/geometamaker.py +7 -5
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker/models.py +3 -3
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker.egg-info/PKG-INFO +14 -2
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker.egg-info/SOURCES.txt +1 -0
- geometamaker-0.1.2/src/geometamaker.egg-info/requires.txt +11 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/tests/test_geometamaker.py +31 -2
- geometamaker-0.1.0/HISTORY.rst +0 -8
- {geometamaker-0.1.0 → geometamaker-0.1.2}/.readthedocs.yml +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/LICENSE.txt +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/README.md +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/docs/Makefile +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/docs/environment-rtd.yml +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/docs/make.bat +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/docs/source/conf.py +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/docs/source/index.rst +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/setup.cfg +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker/__init__.py +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker/config.py +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker/utils.py +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker.egg-info/dependency_links.txt +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker.egg-info/entry_points.txt +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/src/geometamaker.egg-info/top_level.txt +0 -0
- {geometamaker-0.1.0 → geometamaker-0.1.2}/tests/data/template.yml +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Release History
|
|
2
|
+
===============
|
|
3
|
+
|
|
4
|
+
.. Unreleased Changes
|
|
5
|
+
|
|
6
|
+
0.1.2 (2025-02-05)
|
|
7
|
+
------------------
|
|
8
|
+
* Declared dependencies in ``pyproject.toml`` to facilitate pip installs.
|
|
9
|
+
|
|
10
|
+
0.1.1 (2025-02-04)
|
|
11
|
+
------------------
|
|
12
|
+
* Fixed a bug where rasters without a defined nodata value could not be
|
|
13
|
+
described. https://github.com/natcap/geometamaker/issues/70
|
|
14
|
+
* All YAML documents will be written as UTF-8 encoded files.
|
|
15
|
+
https://github.com/natcap/geometamaker/issues/71
|
|
16
|
+
* Fixed a bug in formatting of validation messages about nested attributes
|
|
17
|
+
https://github.com/natcap/geometamaker/issues/65
|
|
18
|
+
* Added exception handling to make validating directories more resilient to
|
|
19
|
+
unreadable yaml files. https://github.com/natcap/geometamaker/issues/62
|
|
20
|
+
|
|
21
|
+
0.1.0 (2025-01-10)
|
|
22
|
+
------------------
|
|
23
|
+
* First release!
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: geometamaker
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: metadata creation for geospatial data
|
|
5
5
|
Maintainer: Natural Capital Project Software Team
|
|
6
6
|
License:
|
|
@@ -219,11 +219,23 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
219
219
|
Classifier: Programming Language :: Python :: 3.10
|
|
220
220
|
Classifier: Programming Language :: Python :: 3.11
|
|
221
221
|
Classifier: Programming Language :: Python :: 3.12
|
|
222
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
222
223
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
223
224
|
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
224
|
-
Requires-Python:
|
|
225
|
+
Requires-Python: >=3.9
|
|
225
226
|
Description-Content-Type: text/markdown
|
|
226
227
|
License-File: LICENSE.txt
|
|
228
|
+
Requires-Dist: aiohttp
|
|
229
|
+
Requires-Dist: click
|
|
230
|
+
Requires-Dist: fsspec
|
|
231
|
+
Requires-Dist: GDAL
|
|
232
|
+
Requires-Dist: frictionless>=5.10.0
|
|
233
|
+
Requires-Dist: numpy
|
|
234
|
+
Requires-Dist: platformdirs
|
|
235
|
+
Requires-Dist: Pydantic>=2.0
|
|
236
|
+
Requires-Dist: pygeoprocessing>=2.4.5
|
|
237
|
+
Requires-Dist: pyyaml
|
|
238
|
+
Requires-Dist: requests
|
|
227
239
|
|
|
228
240
|
A Python library for creating human and machine-readable metadata for geospatial data.
|
|
229
241
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name = "geometamaker"
|
|
3
3
|
description = "metadata creation for geospatial data"
|
|
4
4
|
readme = "README.md"
|
|
5
|
-
requires-python = ">=3.9
|
|
5
|
+
requires-python = ">=3.9"
|
|
6
6
|
license = {file = "LICENSE.txt"}
|
|
7
7
|
maintainers = [
|
|
8
8
|
{name = "Natural Capital Project Software Team"}
|
|
@@ -21,6 +21,7 @@ classifiers = [
|
|
|
21
21
|
"Programming Language :: Python :: 3.10",
|
|
22
22
|
"Programming Language :: Python :: 3.11",
|
|
23
23
|
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
24
25
|
"License :: OSI Approved :: Apache Software License",
|
|
25
26
|
"Topic :: Scientific/Engineering :: GIS"
|
|
26
27
|
]
|
|
@@ -29,6 +30,9 @@ classifiers = [
|
|
|
29
30
|
# using the corresponding setup args `install_requires` and `extras_require`
|
|
30
31
|
dynamic = ["version", "dependencies", "optional-dependencies"]
|
|
31
32
|
|
|
33
|
+
[tool.setuptools.dynamic]
|
|
34
|
+
dependencies = {file = ["requirements.txt"]}
|
|
35
|
+
|
|
32
36
|
[tool.setuptools_scm]
|
|
33
37
|
version_scheme = "post-release"
|
|
34
38
|
local_scheme = "node-and-date"
|
|
@@ -48,7 +48,7 @@ def echo_validation_error(error, filepath):
|
|
|
48
48
|
summary = u'\u2715' + f' {filepath}: {error.error_count()} validation errors'
|
|
49
49
|
click.secho(summary, fg='bright_red')
|
|
50
50
|
for e in error.errors():
|
|
51
|
-
location = '
|
|
51
|
+
location = '.'.join([str(loc) for loc in e['loc']])
|
|
52
52
|
msg_string = (f" {e['msg']}. [input_value={e['input']}, "
|
|
53
53
|
f"input_type={type(e['input']).__name__}]")
|
|
54
54
|
click.secho(location, bold=True)
|
|
@@ -471,15 +471,17 @@ def validate_dir(directory, recursive=False):
|
|
|
471
471
|
for filepath in file_list:
|
|
472
472
|
if filepath.endswith('.yml'):
|
|
473
473
|
yaml_files.append(filepath)
|
|
474
|
+
msg = ''
|
|
474
475
|
try:
|
|
475
476
|
error = validate(filepath)
|
|
476
477
|
if error:
|
|
477
|
-
|
|
478
|
-
else:
|
|
479
|
-
messages.append('')
|
|
478
|
+
msg = error
|
|
480
479
|
except ValueError:
|
|
481
|
-
|
|
482
|
-
|
|
480
|
+
msg = 'does not appear to be a geometamaker document'
|
|
481
|
+
except yaml.YAMLError as exc:
|
|
482
|
+
LOGGER.debug(exc)
|
|
483
|
+
msg = 'is not a readable yaml document'
|
|
484
|
+
messages.append(msg)
|
|
483
485
|
|
|
484
486
|
return (yaml_files, messages)
|
|
485
487
|
|
|
@@ -91,7 +91,7 @@ class BandSchema(Parent):
|
|
|
91
91
|
index: int
|
|
92
92
|
gdal_type: str
|
|
93
93
|
numpy_type: str
|
|
94
|
-
nodata: Union[int, float]
|
|
94
|
+
nodata: Union[int, float, None]
|
|
95
95
|
description: str = ''
|
|
96
96
|
title: str = ''
|
|
97
97
|
units: str = ''
|
|
@@ -242,7 +242,7 @@ class Profile(BaseMetadata):
|
|
|
242
242
|
target_path (str): path to a yaml file to be written
|
|
243
243
|
|
|
244
244
|
"""
|
|
245
|
-
with open(target_path, 'w') as file:
|
|
245
|
+
with open(target_path, 'w', encoding='utf-8') as file:
|
|
246
246
|
file.write(utils.yaml_dump(self.model_dump()))
|
|
247
247
|
|
|
248
248
|
|
|
@@ -523,7 +523,7 @@ class Resource(BaseMetadata):
|
|
|
523
523
|
target_path = os.path.join(
|
|
524
524
|
workspace, os.path.basename(self.metadata_path))
|
|
525
525
|
|
|
526
|
-
with open(target_path, 'w') as file:
|
|
526
|
+
with open(target_path, 'w', encoding='utf-8') as file:
|
|
527
527
|
file.write(utils.yaml_dump(
|
|
528
528
|
self.model_dump(exclude=['metadata_path'])))
|
|
529
529
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: geometamaker
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: metadata creation for geospatial data
|
|
5
5
|
Maintainer: Natural Capital Project Software Team
|
|
6
6
|
License:
|
|
@@ -219,11 +219,23 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
219
219
|
Classifier: Programming Language :: Python :: 3.10
|
|
220
220
|
Classifier: Programming Language :: Python :: 3.11
|
|
221
221
|
Classifier: Programming Language :: Python :: 3.12
|
|
222
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
222
223
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
223
224
|
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
224
|
-
Requires-Python:
|
|
225
|
+
Requires-Python: >=3.9
|
|
225
226
|
Description-Content-Type: text/markdown
|
|
226
227
|
License-File: LICENSE.txt
|
|
228
|
+
Requires-Dist: aiohttp
|
|
229
|
+
Requires-Dist: click
|
|
230
|
+
Requires-Dist: fsspec
|
|
231
|
+
Requires-Dist: GDAL
|
|
232
|
+
Requires-Dist: frictionless>=5.10.0
|
|
233
|
+
Requires-Dist: numpy
|
|
234
|
+
Requires-Dist: platformdirs
|
|
235
|
+
Requires-Dist: Pydantic>=2.0
|
|
236
|
+
Requires-Dist: pygeoprocessing>=2.4.5
|
|
237
|
+
Requires-Dist: pyyaml
|
|
238
|
+
Requires-Dist: requests
|
|
227
239
|
|
|
228
240
|
A Python library for creating human and machine-readable metadata for geospatial data.
|
|
229
241
|
|
|
@@ -20,6 +20,7 @@ src/geometamaker.egg-info/PKG-INFO
|
|
|
20
20
|
src/geometamaker.egg-info/SOURCES.txt
|
|
21
21
|
src/geometamaker.egg-info/dependency_links.txt
|
|
22
22
|
src/geometamaker.egg-info/entry_points.txt
|
|
23
|
+
src/geometamaker.egg-info/requires.txt
|
|
23
24
|
src/geometamaker.egg-info/top_level.txt
|
|
24
25
|
tests/test_geometamaker.py
|
|
25
26
|
tests/data/template.yml
|
|
@@ -57,7 +57,7 @@ def create_vector(target_filepath, field_map=None, driver='GEOJSON'):
|
|
|
57
57
|
def create_raster(
|
|
58
58
|
numpy_dtype, target_path,
|
|
59
59
|
pixel_size=(1, 1), projection_epsg=4326,
|
|
60
|
-
origin=(0, 0), n_bands=2):
|
|
60
|
+
origin=(0, 0), n_bands=2, define_nodata=True):
|
|
61
61
|
driver_name, creation_options = DEFAULT_GTIFF_CREATION_TUPLE_OPTIONS
|
|
62
62
|
raster_driver = gdal.GetDriverByName(driver_name)
|
|
63
63
|
ny, nx = (2, 2)
|
|
@@ -76,11 +76,13 @@ def create_raster(
|
|
|
76
76
|
raster.SetProjection(projection_wkt)
|
|
77
77
|
|
|
78
78
|
base_array = numpy.full((2, 2), 1, dtype=numpy_dtype)
|
|
79
|
+
|
|
79
80
|
target_nodata = pygeoprocessing.choose_nodata(numpy_dtype)
|
|
80
81
|
|
|
81
82
|
for i in range(n_bands):
|
|
82
83
|
band = raster.GetRasterBand(i + 1)
|
|
83
|
-
|
|
84
|
+
if define_nodata:
|
|
85
|
+
band.SetNoDataValue(target_nodata)
|
|
84
86
|
band.WriteArray(base_array)
|
|
85
87
|
band = None
|
|
86
88
|
raster = None
|
|
@@ -274,6 +276,17 @@ class GeometamakerTests(unittest.TestCase):
|
|
|
274
276
|
resource = geometamaker.describe(datasource_path)
|
|
275
277
|
self.assertEqual(resource.spatial.crs, 'unknown')
|
|
276
278
|
|
|
279
|
+
def test_describe_raster_no_nodata(self):
|
|
280
|
+
"""Test for a raster that has no nodata value."""
|
|
281
|
+
import geometamaker
|
|
282
|
+
|
|
283
|
+
datasource_path = os.path.join(self.workspace_dir, 'raster.tif')
|
|
284
|
+
create_raster(numpy.int16, datasource_path,
|
|
285
|
+
projection_epsg=None, define_nodata=False)
|
|
286
|
+
|
|
287
|
+
resource = geometamaker.describe(datasource_path)
|
|
288
|
+
self.assertIsNone(resource.data_model.bands[0].nodata)
|
|
289
|
+
|
|
277
290
|
def test_describe_zip(self):
|
|
278
291
|
"""Test metadata for a zipfile includes list of contents."""
|
|
279
292
|
import zipfile
|
|
@@ -663,6 +676,22 @@ class GeometamakerTests(unittest.TestCase):
|
|
|
663
676
|
self.workspace_dir, recursive=True)
|
|
664
677
|
self.assertEqual(len(yaml_files), 2)
|
|
665
678
|
|
|
679
|
+
def test_validate_dir_handles_exception(self):
|
|
680
|
+
"""Test validate_dir function handles yaml exceptions."""
|
|
681
|
+
import geometamaker
|
|
682
|
+
|
|
683
|
+
yaml_path = os.path.join(self.workspace_dir, 'foo.yml')
|
|
684
|
+
with open(yaml_path, 'w') as file:
|
|
685
|
+
# An example from a yaml file containing some jinja templating.
|
|
686
|
+
# This should raise a yaml.scanner.ScannerError:
|
|
687
|
+
# while scanning for the next token
|
|
688
|
+
# found character '%' that cannot start any token
|
|
689
|
+
file.write('{% set name = "simplejson" %}')
|
|
690
|
+
|
|
691
|
+
yaml_files, msgs = geometamaker.validate_dir(self.workspace_dir)
|
|
692
|
+
self.assertEqual(len(yaml_files), 1)
|
|
693
|
+
self.assertEqual(msgs[0], 'is not a readable yaml document')
|
|
694
|
+
|
|
666
695
|
def test_describe_dir_with_shapefile(self):
|
|
667
696
|
"""Test describe directory containing a multi-file dataset."""
|
|
668
697
|
import geometamaker
|
geometamaker-0.1.0/HISTORY.rst
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|