Scene and Dataset wrappers

Textory satpy Scene and xarray Dataset wrappers

Calculate textures for Scene

With the textures_for_scene() function it is easy to calculate one or multiple textures with the same or different parameters for datasets in a satpy.scene.Scene. The function will return a new Scene either with the textures in addition to all input datasets (default) or a Scene only with the textures, depending on the append parameter of the function.

The textures parameter takes a dictionary where the keys are a tuple with the texture and the parameters which to calculate and the values are a list (or list of tuples in the case of textures which require two inputs) of the datasets to apply the texture to in the general form of:

textures_dict = {("texture_name", lag, win_size, win_geom): [list of dataset names]}

The following example would calculate the variogram with lag=2, win_size=7, win_geom=”square” for the datasets with name “IR_039” and “IR_108” as well as the cross variogram with lag=1, win_size=5, and win_geom=”round” between the datasets with name “WV_062” and “IR_108” of the Scene.

import textory as tx

scn = Scene(...)
textures_dict = {("variogram", 2, 7, "square"): ["IR_039", "IR_108"],
                 ("cross_variogram", 1, 5, "round"): [("WV_062", "IR_108")]}
scn_with_textures = tx.textures_for_scene(scn, textures=textures_dict)

Calculate textures for xarray Dataset

The textures_for_xr_dataset() function works similarly to the textures_for_scene() function above but takes xarray.Dataset as input and also returns a xarray.Dataset.