ruithnadsteud / yt_georaster

A package for handling geotiff files and georeferenced datasets within yt.
1 stars 2 forks source link

add save_as_geotiff function #23

Closed brittonsmith closed 3 years ago

brittonsmith commented 3 years ago

This adds the save_as_geotiff function to selected fields from a data container to a multiband GeoTiff file. With this, one can do:

fns = glob.glob(os.path.join("M2_Sentinel-2_test_data", "*.jp2")) + \
  glob.glob(os.path.join("Landsat-8_sample_L2", "*.TIF"))

ds = yt.load(*fns)

circle = ds.circle(ds.domain_center, (10, 'km'))
fields = [("bands", "LS_B1"),
          ("bands", "S2_B06"),
          ("band_ratios", "S2_NDWI")]
ds_fn, fm_fn = save_as_geotiff(ds, "my_data.tiff", fields=fields, data_source=circle)

ds2 = yt.load(ds_fn, field_map=fm_fn)

To do this, I've slightly changed the format of the field map yaml file. I've also added some new tests.