<jupyter_start><jupyter_text>Analysis Ready Sentinel-1 Backscatter Imagery<jupyter_code>import datetime
import itertools

import fsspec
import intake
import pandas as pd
import s3fs
import xarray as xr
# set up a connection with credentials and other settings
fs = fsspec.filesystem('s3', anon=True)
bucket = 'sentinel-s1-rtc-indigo/tiles/RTC/1/IW'
fs.ls(bucket)<jupyter_output><empty_output><jupyter_text>- Documentation: https://sentinel-s1-rtc-indigo-docs.s3-us-west-2.amazonaws.com/data_format.htmldata-structure<jupyter_code># set up configurations for our parameters of interest
UTM_ZONE_COMPONENT = [13, 14]
LATITUDE_BANDS = ["T", "U"]
GRID_SQUARE_IDS = ["BE", "PN"]
YEARS = [2021]
SATELLITES = ["S1B"]
# Loop over a combination of possible configurations and construct s3 object paths
params = list(
    itertools.product(*[UTM_ZONE_COMPONENT, LATITUDE_BANDS, GRID_SQUARE_IDS, YEARS, SATELLITES])
)
paths = [
    f"s3://{bucket}/{utm_zone}/{latitude_band}/{grid_square_id}/{year}/{satellite}*/Gamma0_VV.tif"
    for utm_zone, latitude_band, grid_square_id, year, satellite in params
]
paths
fs.ls('s3://sentinel-s1-rtc-indigo/tiles/RTC/1/IW/13/T/BE')
# Look at the items from the first path
items = fs.glob(paths[0])
items
# Open one image
ds = xr.open_rasterio(f"s3://{items[0]}", chunks={})
ds
# Function for cleaning the data: rename band -> time and create datetime object
def preprocess(ds):
    ds["band"] = [datetime.datetime.fromisoformat(ds.attrs["DATE"])]
    ds = ds.rename({'band': 'time'})
    return ds
preprocess(ds)
dataarrays = [
    preprocess(
        xr.open_rasterio(
            f"s3://{url}",
            chunks={},
        )
    )
    for url in items
]
da = xr.concat(dataarrays, dim='time', join='override', combine_attrs='drop')
da<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13864142538975502, 'fraction_numerical': 0.016146993318485525, 'mean_word_length': 4.741214057507987, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '206334', 'license': 'MIT', 'n_tokens_mistral': 695, 'n_tokens_neox': 669, 'n_words': 146, 'path': 'notebooks/01-getting-started-without-intake.ipynb', 'repo_name': 'andersy005/intake-tutorial', 'size': '1796'}