Skip to content

Instantly share code, notes, and snippets.

View bpostance's full-sized avatar

Ben Postance bpostance

View GitHub Profile
from osgeo import gdal
in_file = f"./modis.hdf" # raw MODIS HDF in sinusoid projection
out_file = f"./modis.tif"
# open dataset
dataset = gdal.Open(in_file,gdal.GA_ReadOnly)
subdataset = gdal.Open(dataset.GetSubDatasets()[0][0], gdal.GA_ReadOnly)
# gdalwarp
@bpostance
bpostance / gist:ecca4bc3ce4477c274fdf9282a4c8223
Created April 19, 2021 20:52
Function to tranform Pandas DataFrame to Plotly Sankey diagram input
"""
Example function to convert DataFrame object to Plotly Sankey diagram data dictionary.
Example notebook: https://github.com/bpostance/dsc.learn/blob/main/Graph/00-misc/finCEN.ipynb
"""
def df_2_sankey(df,cols,values,hover_value=None):
""" Helper function to convert a dataframe of relationships to
Plotly Sankey format.
"""