-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_metadata.py
70 lines (53 loc) · 1.7 KB
/
test_metadata.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from osgeo import osr
import os
from osgeo import gdal
import logging
import numpy
from ecoshard import geoprocessing
import ecoshard
logging.basicConfig(
level=logging.DEBUG,
format=(
'%(asctime)s (%(relativeCreated)d) %(levelname)s %(name)s'
' [%(funcName)s:%(lineno)d] %(message)s'))
LOGGER = logging.getLogger(__name__)
import git
def main():
# make raster
repo = git.Repo(search_parent_directories=True)
sha = repo.head.object.hexsha
#help(repo)
LOGGER.debug(f'{repo.remote().url}/{sha}/{__file__}')
return
raster_path = 'single_pixel.tif'
geoprocessing.numpy_array_to_raster(
numpy.array([[1]]), 0, (1, -1), (0, 0), None,
'single_pixel.tif')
# ecoshard.add_metadata(raster_path, {
# 'RSTITLE': 'single pixel',
# 'RSABSTR': 'test medatadata',
# }, 'GEO_METADATA')
# full_title - descriptive title of dataset
# abstract -
# how it was generated
# script file
# input files and parameters
# date
# input configuration files like INI -- INI was ecoshard standard
# recursive info on input file configurations
# uses
# searchable by all those metadata
# want to know what produced this file so the inputs are the
# most important info
# visual family tree rep (description, dates)
# build_metadata=True
ecoshard.add_metadata(raster_path, {
'TIFFTAG_DOCUMENTNAME': 'single pixel',
})
metadata = ecoshard.get_metadata(raster_path)
LOGGER.debug(f'metadata: {metadata}')
raster = gdal.OpenEx(raster_path)
LOGGER.debug(raster.GetMetadataDomainList())
return
if __name__ == '__main__':
main()