SINTEF / Geomaker

4 stars 4 forks source link

Bug: is metadata 'VerticalUnitsGeoKey' really neccessary? #38

Closed VikingScientist closed 4 years ago

VikingScientist commented 4 years ago

It seems that not all of the meta-data is present at all times. In particular if you download Værøy DOM10 not as a dedicated file, then VerticalUnitsGeoKey is not present in the tiffile.

Traceback (most recent call last):
  File "/home/kjetijo/.local/lib/python3.6/site-packages/GeoMaker-0.1-py3.6.egg/geomaker/asynchronous.py", line 229, in process
    result = self.job.process(self)
  File "/home/kjetijo/.local/lib/python3.6/site-packages/GeoMaker-0.1-py3.6.egg/geomaker/asynchronous.py", line 380, in process
    job.process(manager, *args, **kwargs)
  File "/home/kjetijo/.local/lib/python3.6/site-packages/GeoMaker-0.1-py3.6.egg/geomaker/asynchronous.py", line 410, in process
    retval = job.process(manager, retval)
  File "/home/kjetijo/.local/lib/python3.6/site-packages/GeoMaker-0.1-py3.6.egg/geomaker/asynchronous.py", line 394, in process
    return self.job.process(manager, arg)
  File "/home/kjetijo/.local/lib/python3.6/site-packages/GeoMaker-0.1-py3.6.egg/geomaker/asynchronous.py", line 364, in process
    retval = self.func(*args, **kwargs, manager=manager)
  File "/home/kjetijo/.local/lib/python3.6/site-packages/GeoMaker-0.1-py3.6.egg/geomaker/db.py", line 625, in _download_data
    util.verify_geotiff(filename)
  File "/home/kjetijo/.local/lib/python3.6/site-packages/GeoMaker-0.1-py3.6.egg/geomaker/util.py", line 258, in verify_geotiff
    assert metadata['VerticalUnitsGeoKey'] == geodb.Linear.Meter
KeyError: 'VerticalUnitsGeoKey'

The complete list of metadata for this particular tiffile is

{'KeyDirectoryVersion': 1,
 'KeyRevision': 1,
 'KeyRevisionMinor': 0,
 'GTModelTypeGeoKey': <ModelType.Projected: 1>,
 'GTRasterTypeGeoKey': <RasterPixel.IsArea: 1>,
 'GTCitationGeoKey': 'PCS Name = ETRS_1989_UTM_Zone_33N',
 'GeographicTypeGeoKey': <GCS.EUREF89: 4258>,
 'GeogCitationGeoKey': 'GCS Name = GCS_ETRS_1989|Datum = D_ETRS_1989|Ellipsoid = GRS_1980|Primem = Greenwich|',
 'GeogGeodeticDatumGeoKey': 6258,
 'GeogPrimeMeridianGeoKey': <PM.Greenwich: 8901>,
 'GeogAngularUnitsGeoKey': <Angular.Degree: 9102>,
 'GeogAngularUnitsSizeGeoKey': 0.0174532925199433,
 'GeogEllipsoidGeoKey': <Ellipse.GRS_1980: 7019>,
 'GeogSemiMajorAxisGeoKey': 6378137.0,
 'GeogInvFlatteningGeoKey': 298.257222101,
 'GeogPrimeMeridianLongGeoKey': 0.0,
 'ProjectedCSTypeGeoKey': 25833,
 'PCSCitationGeoKey': 'ESRI PE String = PROJCS["ETRS_1989_UTM_Zone_33N",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",15.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]',
 'ProjLinearUnitsGeoKey': <Linear.Meter: 9001>,
 'ModelPixelScale': [10.0, 10.0, 0.0],
 'ModelTiepoint': [0.0, 0.0, 0.0, 271025.0, 7033125.0, 0.0]}
TheBB commented 4 years ago

No, not everything is necessary. I just wanted to be extra careful so I didn't accidentally rely on an unstated assumption that turned out to be invalid.