<jupyter_start><jupyter_text>This throws out about 4 fires out of >45 that don't conform to the same filename type<jupyter_code>metadata = sorted([str(path.name).split("_")[:-1] for path in img_paths if len(str(path).split("_")) == 4]) # getting metadata from filenames
df = pd.DataFrame(metadata, columns=['site', 'date', 'product'])
df["datetime"] = pd.to_datetime(df['date'])
df.index = df['datetime']
df = df.sort_index()
df
img_list = []
for i in img_paths:
    x = rx.open_rasterio(i)
    x.name = i.name
    img_list.append(x)
nlcd_2016 = rx.open_rasterio(data_path / "external/")<jupyter_output><empty_output><jupyter_text>Need to check the present day (2016 NLCD) land cover classes for each burned area to make sure it has forest coverage type. Use this filter for selection before downloading gEDI data and store the majority land cover class within the df.<jupyter_code>for i in img_list:
    i.rio.reproject(4326).rio.to_raster(str(out_path / Path("WGS84_"+str(i.name))))
def bounds_request(bounds):
    """
    Requests GEDI L2B data download links using the GEDI Finder service.
    
    https://lpdaacsvc.cr.usgs.gov/services/gedifinder
    
    Args:
        bounds returned from rioxarray rAster Array.
        It's unpacked to ul_lat,ul_lon,lr_lat,lr_lon
    """
    ul_lon = bounds[0]
    ul_lat = bounds[-1]
    lr_lon = bounds[2]
    lr_lat = bounds[1]
    result = r.get(f"https://lpdaacsvc.cr.usgs.gov/services/gedifinder?product=GEDI01_B&version=001&bbox=[{ul_lat},{ul_lon},{lr_lat},{lr_lon}]")
    print(result)
    return result.json()['data']
    
all_urls = []
for i in img_list:
    url_list = bounds_request(i.rio.bounds())
    if len(url_list) > 0:
        all_urls.extend(url_list)
with open("fire_gedi_url_list.txt", 'w') as output:
    for row in all_urls:
        output.write(str(row) + '\n')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13394298009682626, 'fraction_numerical': 0.01613770844540075, 'mean_word_length': 4.2100840336134455, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '508351', 'license': 'MIT', 'n_tokens_mistral': 689, 'n_tokens_neox': 670, 'n_words': 160, 'path': 'fire_regrowth_structure.ipynb', 'repo_name': 'rbavery/sprnca_gedi', 'size': '1859'}