S
SolaraYordan Radev

https panel holoviz org gallery glaciers

https://panel.holoviz.org/gallery/glaciers.html I want to open files into Xarray datasets, rasterize and visualize them directly on top of a HPC file system. Interactive maps, cross selection dynamically defined and instanciated widgets all for geospatial data.
M
MaartenBreddels307d ago
i cannot get this example to work, which version of panel, holoviews etc do i need for this? I translated a subset of that example to solara, to get an idea
M
MaartenBreddels307d ago
No description
M
MaartenBreddels307d ago
import numpy as np
import pandas as pd
from holoviews.element.tiles import lon_lat_to_easting_northing

import solara
import solara.express as px

df = pd.read_parquet("https://datasets.holoviz.org/oggm_glaciers/v1/oggm_glaciers.parq")
df["latdeg"] = df.cenlat
df["x"], df["y"] = lon_lat_to_easting_northing(df.cenlon, df.cenlat)
total_area = df.area_km2.sum()


@solara.component
def Layout(children=[]):
filter, _set_filter = solara.use_cross_filter(id(df))
dff = df[filter] if filter is not None else df
selected_area = np.sum(dff["area_km2"])
selected_percentage = selected_area / total_area * 100
title_text = f"### Glaciers selected: {len(dff)} | Area: {selected_area:.0f} km² ({selected_percentage:.1f}%)</font>"
md = solara.Markdown(title_text, style={"color": "white"})
solara.AppLayout(children=children, title=md)


@solara.component
def Scatter():
# if you want to do something custom, use the use_cross_filter hook
# filter, _set_filter = solara.use_cross_filter()
# dff = df
px.scatter(df, "avg_prcp", "mean_elev")


@solara.component
def Temp():
# if you want to do something custom, use the use_cross_filter hook
# filter, _set_filter = solara.use_cross_filter()
# dff = df
px.histogram(df, "avg_temp_at_mean_elev")


@solara.component
def Page():
with solara.Columns():
Scatter()
Temp()
import numpy as np
import pandas as pd
from holoviews.element.tiles import lon_lat_to_easting_northing

import solara
import solara.express as px

df = pd.read_parquet("https://datasets.holoviz.org/oggm_glaciers/v1/oggm_glaciers.parq")
df["latdeg"] = df.cenlat
df["x"], df["y"] = lon_lat_to_easting_northing(df.cenlon, df.cenlat)
total_area = df.area_km2.sum()


@solara.component
def Layout(children=[]):
filter, _set_filter = solara.use_cross_filter(id(df))
dff = df[filter] if filter is not None else df
selected_area = np.sum(dff["area_km2"])
selected_percentage = selected_area / total_area * 100
title_text = f"### Glaciers selected: {len(dff)} | Area: {selected_area:.0f} km² ({selected_percentage:.1f}%)</font>"
md = solara.Markdown(title_text, style={"color": "white"})
solara.AppLayout(children=children, title=md)


@solara.component
def Scatter():
# if you want to do something custom, use the use_cross_filter hook
# filter, _set_filter = solara.use_cross_filter()
# dff = df
px.scatter(df, "avg_prcp", "mean_elev")


@solara.component
def Temp():
# if you want to do something custom, use the use_cross_filter hook
# filter, _set_filter = solara.use_cross_filter()
# dff = df
px.histogram(df, "avg_temp_at_mean_elev")


@solara.component
def Page():
with solara.Columns():
Scatter()
Temp()
YR
Yordan Radev306d ago
Thank you I am looking into how interdependant widgets and geo libraries like GeoViews, Xarray, Xesmf could be implemented in Solara to see if it is even possible to switch from Panel. I guess I will hang back for the moment sir. Thank you so much for your time and I hope Solara grows quickly 🙂