Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions src/e3sm_quickview/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,11 @@ async def data_loading_open(self, simulation, connectivity):
conn_file=connectivity,
)

# A different format means a different pipeline; existing views are
# still wired to the old one.
if self.source.path_changed:
self.view_manager.drop_views()

self.file_browser.loading_completed(self.source.valid)

if self.source.valid:
Expand Down Expand Up @@ -687,9 +692,30 @@ def _on_slicing_change(self, var, ind_var, **_):
geom_filter.Update()
data = geom_filter.GetOutput()
self.state.fields_avgs = compute.extract_avgs(
data, self.selected_variable_names
data, self.selected_variable_names, self.source.association
)

@change("longitude_origin")
def _on_longitude_origin(self, longitude_origin, **_):
"""Rotate the map so its left edge sits at the chosen longitude."""
if not self.source.valid:
return

origin = float(longitude_origin)
with perf.timed("longitude_origin.total"):
self.source.SetLongitudeOrigin(origin)
# The crop is expressed in the map's own longitudes, so rotating the
# map invalidates the previous selection -- a stale one would sit
# partly outside the window, or straddle its seam, which the box
# crop used for the continents and the graticule cannot represent.
with self.state as s:
s.crop_longitude = [origin, origin + 360]
s.crop_longitude_min = origin
s.crop_longitude_max = origin + 360
self.view_manager.update_color_range()
self.view_manager.reset_camera()
self.view_manager.render()

@change(
"variables_loaded",
"crop_longitude",
Expand Down Expand Up @@ -725,7 +751,7 @@ def _on_downstream_change(
geom_filter.Update()
data = geom_filter.GetOutput()
self.state.fields_avgs = compute.extract_avgs(
data, self.selected_variable_names
data, self.selected_variable_names, self.source.association
)

def toggle_toolbar(self, toolbar_name=None):
Expand Down
28 changes: 24 additions & 4 deletions src/e3sm_quickview/components/toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ def __init__(self):
)
v3.VRangeSlider(
v_model=("crop_longitude", [-180, 180]),
min=-180,
max=180,
min=("longitude_origin",),
max=("longitude_origin + 360",),
step=1,
density="compact",
hide_details=True,
Expand Down Expand Up @@ -407,11 +407,31 @@ def __init__(self):
density="compact",
hide_details=True,
)

with v3.VCol():
with v3.VRow(classes="mx-2 my-0"):
v3.VLabel(
"Map origin",
classes="text-subtitle-2",
)
v3.VSpacer()
v3.VLabel(
"{{ longitude_origin }} to {{ longitude_origin + 360 }}",
classes="text-body-2",
)
v3.VSlider(
v_model=("longitude_origin", -180),
min=-180,
max=180,
step=1,
density="compact",
hide_details=True,
)
with v3.VRow(classes="ma-0 pl-6 pr-2 align-center ga-4", v_else=True):
v3.VNumberInput(
label="Longitude (min)",
v_model=("crop_longitude_min", -180),
min=[-180],
min=("longitude_origin",),
max=("crop_longitude_max", 180),
step=[1],
hide_details=True,
Expand All @@ -424,7 +444,7 @@ def __init__(self):
label="Longitude (max)",
v_model=("crop_longitude_max", 180),
min=("crop_longitude_min", -180),
max=[180],
max=("longitude_origin + 360",),
step=[1],
hide_details=True,
density="comfortable",
Expand Down
Loading
Loading