geowatch.cli.geotiffs_to_kwcoco module

Attempts to register directory of geotiffs into a kwcoco dataset

class geowatch.cli.geotiffs_to_kwcoco.KWCocoFromGeotiffConfig(*args, **kwargs)[source]

Bases: DataConfig

Create a kwcoco manifest of a set of on-disk geotiffs

Valid options: []

Parameters:
  • *args – positional arguments for this data config

  • **kwargs – keyword arguments for this data config

default = {'dst': <Value(None)>, 'geotiff_dpath': <Value(None)>, 'relative': <Value(False)>, 'strict': <Value(False)>, 'workers': <Value(0)>}
geowatch.cli.geotiffs_to_kwcoco.main(cmdline=1, **kwargs)[source]
geowatch.cli.geotiffs_to_kwcoco.filter_band_files(fpaths, band_list, with_tci=True)[source]

band_list is any subset of util_bands.ALL_BANDS

with_tci: include true color thumbnail

geowatch.cli.geotiffs_to_kwcoco.ingest_landsat_directory(lc_dpath)[source]
geowatch.cli.geotiffs_to_kwcoco.ingest_sentinel2_directory(s2_dpath)[source]
geowatch.cli.geotiffs_to_kwcoco.make_coco_img_from_geotiff(tiff_fpath, name=None, force_affine=True, with_info=False)[source]

TODO: move to coco extensions

Example

>>> from geowatch.demo.landsat_demodata import grab_landsat_product  # NOQA
>>> product = grab_landsat_product()
>>> tiffs = product['bands'] + [product['meta']['bqa']]
>>> tiff_fpath = product['bands'][0]
>>> name = None
>>> img = make_coco_img_from_geotiff(tiff_fpath)
>>> print('img = {}'.format(ub.urepr(img, nl=1)))
geowatch.cli.geotiffs_to_kwcoco.make_coco_img_from_auxiliary_geotiffs(tiffs, name)[source]

TODO: move to coco extensions

Example

>>> from geowatch.demo.landsat_demodata import grab_landsat_product  # NOQA
>>> product = grab_landsat_product()
>>> tiffs = product['bands'] + [product['meta']['bqa']]
>>> name = product['scene_name']
>>> img = make_coco_img_from_auxiliary_geotiffs(tiffs, name)
>>> print('img = {}'.format(ub.urepr(img, nl=-1, sort=0)))
geowatch.cli.geotiffs_to_kwcoco.make_coco_img_from_auxiliary_dicts(auxiliary, name)[source]
geowatch.cli.geotiffs_to_kwcoco.find_geotiffs(geotiff_dpath, workers=0, strict=False)[source]

Search a directory for any geotiffs and return a set of kwcoco-style image dictionaries detailing the results.

Parameters:

geotiff_dpath (str) – directory to search

Returns:

a list of kwcoco-style image dictionaries

Return type:

List[Dict]

geotiff_dpath = ‘/home/joncrall/data/grab_tiles_out/fels’