def geotiffs(tmpdir_factory): """Create test geotiffs and corresponding yamls. We create one yaml per time slice, itself comprising one geotiff per band, each with specific custom data that can be later tested. These are meant to be used by all tests in the current session, by way of symlinking the yamls and tiffs returned by this fixture, in order to save disk space (and potentially generation time). The yamls are customised versions of :ref:`_EXAMPLE_LS5_NBAR_DATASET_FILE` shifted by 24h and with spatial coords reflecting the size of the test geotiff, defined in :ref:`GEOTIFF`. :param tmpdir_fatory: pytest tmp dir factory. :return: List of dictionaries like:: { 'day':..., # compact day string, e.g. `19900302` 'uuid':..., # a unique UUID for this dataset (i.e. specific day) 'path':..., # path to the yaml ingestion file 'tiffs':... # list of paths to the actual geotiffs in that dataset, one per band. } """ tiffs_dir = tmpdir_factory.mktemp('tiffs') config = load_yaml_file(_EXAMPLE_LS5_NBAR_DATASET_FILE)[0] # Customise the spatial coordinates ul = GEOTIFF['ul'] lr = { dim: ul[dim] + GEOTIFF['shape'][dim] * GEOTIFF['pixel_size'][dim] for dim in ('x', 'y') } config['grid_spatial']['projection']['geo_ref_points'] = { 'ul': ul, 'ur': { 'x': lr['x'], 'y': ul['y'] }, 'll': { 'x': ul['x'], 'y': lr['y'] }, 'lr': lr } # Generate the custom geotiff yamls return [ _make_tiffs_and_yamls(tiffs_dir, config, day_offset) for day_offset in range(NUM_TIME_SLICES) ]
def example_ls5_nbar_metadata_doc(): return load_yaml_file(_EXAMPLE_LS5_NBAR_DATASET_FILE)[0]