-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor updates to data models #60
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a3378bc
change metadata_version to geometamaker_version. #58
davemfish 1f152aa
deprecate some unused attributes and issue FutureWarnings. #58
davemfish 819fdf9
add timezone to datetime stamp. #58
davemfish 84d2bca
add 'name' to list of deprecated attrs. #58
davemfish b9633b3
migrate raster size from list to dict. #58
davemfish c6235f0
use Python3.9 type syntax. #58
davemfish f41e17f
don't sort the yaml keys alphabetically. #58
davemfish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
'https', | ||
] | ||
|
||
DT_FMT = '%Y-%m-%d %H:%M:%S' | ||
DT_FMT = '%Y-%m-%d %H:%M:%S %Z' | ||
|
||
|
||
# TODO: In the future we can remove these exception managers in favor of the | ||
|
@@ -179,6 +179,10 @@ def describe_file(source_dataset_path, scheme): | |
f'{description["bytes"]}{description["last_modified"]}\ | ||
{description["path"]}'.encode('ascii')) | ||
description['uid'] = f'sizetimestamp:{hash_func.hexdigest()}' | ||
|
||
# We don't have a use for including these attributes in our metadata: | ||
description.pop('mediatype', None) | ||
description.pop('name', None) | ||
return description | ||
|
||
|
||
|
@@ -196,7 +200,7 @@ def describe_archive(source_dataset_path, scheme): | |
description = describe_file(source_dataset_path, scheme) | ||
# innerpath is from frictionless and not useful because | ||
# it does not include all the files contained in the zip | ||
del description['innerpath'] | ||
description.pop('innerpath', None) | ||
|
||
ZFS = fsspec.get_filesystem_class('zip') | ||
zfs = ZFS(source_dataset_path) | ||
|
@@ -269,7 +273,8 @@ def describe_raster(source_dataset_path, scheme): | |
description['data_model'] = models.RasterSchema( | ||
bands=bands, | ||
pixel_size=info['pixel_size'], | ||
raster_size=info['raster_size']) | ||
raster_size={'width': info['raster_size'][0], | ||
'height': info['raster_size'][1]}) | ||
Comment on lines
+276
to
+277
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also like that this could be expanded to include the number of bands or any other attributes that expression the dimensionality of the dataset in the future, should it become necessary. |
||
# Some values of raster info are numpy types, which the | ||
# yaml dumper doesn't know how to represent. | ||
bbox = models.BoundingBox(*[float(x) for x in info['bounding_box']]) | ||
|
@@ -425,8 +430,8 @@ def validate(filepath): | |
with fsspec.open(filepath, 'r') as file: | ||
yaml_string = file.read() | ||
yaml_dict = yaml.safe_load(yaml_string) | ||
if not yaml_dict or 'metadata_version' not in yaml_dict \ | ||
or not yaml_dict['metadata_version'].startswith('geometamaker'): | ||
if not yaml_dict or ('metadata_version' not in yaml_dict | ||
and 'geometamaker_version' not in yaml_dict): | ||
message = (f'{filepath} exists but is not compatible with ' | ||
f'geometamaker.') | ||
raise ValueError(message) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,5 @@ def yaml_dump(data): | |
return yaml.dump( | ||
data, | ||
allow_unicode=True, | ||
sort_keys=False, | ||
Dumper=_SafeDumper) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!