Skip to content
Snippets Groups Projects
Commit c22a24db authored by Nils Brüggemann's avatar Nils Brüggemann
Browse files

pyic_view: Improve zooming in non-lonlat projections. Allowing to reset zoom area.

parent 2d0a6284
No related branches found
No related tags found
No related merge requests found
......@@ -274,6 +274,11 @@ class view(object):
command=self.activate_zoom)
self.zoom_button.pack(side="left", padx=5)
# Button to reset zoom
reset_zoom_button = ttk.Button(frame3, text="Reset zoom",
command=self.reset_zoom)
reset_zoom_button.pack(side="left", padx=5)
# proj entry
print('Setup proj dropdown')
res_menu = ttk.Combobox(frame3, textvariable=self.selected_proj,
......@@ -281,7 +286,6 @@ class view(object):
res_menu.pack(side="left", padx=5)
res_menu.bind("<<ComboboxSelected>>", self.make_new_axis)
# --- end tk objects
# initial plot
......@@ -293,6 +297,12 @@ class view(object):
root.mainloop()
return
# reset zoom
def reset_zoom(self):
self.lon_lat_reg_tk.set("-180,180,-90,90")
self.make_new_axis()
self.update_data()
# for saving the figure
def save_figure(self, *args):
fpath = self.save_fig_tk.get()
......@@ -423,8 +433,10 @@ class view(object):
valid = np.isfinite(self.X) & np.isfinite(self.Y)
self.hm = pyic.shade(
#self.X[valid], self.Y[valid], self.dai.data[valid],
self.X, self.Y, self.dai.data,
ax=self.ax, cax=self.cax)
self.X, self.Y, self.dai.to_masked_array(),
ax=self.ax, cax=self.cax,
adjust_axlims=False,
)
# set ax limits
if self.proj=="+proj=stere +lat_0=90 +lon_0=0":
self.ax.set_xlim([-4660515.349812048, 4660515.349812048])
......@@ -495,8 +507,15 @@ class view(object):
def update_data_range(self):
xlim = self.ax.get_xlim()
ylim = self.ax.get_ylim()
lon_lat_reg_str = f'{xlim[0]:3g},{xlim[1]:3g},{ylim[0]:3g},{ylim[1]:3g}'
print(lon_lat_reg_str)
if self.proj!='None':
lon_lim, lat_lim = self.transformer.transform(
xlim, ylim,
direction='INVERSE',
)
else:
lon_lim = xlim
lat_lim = ylim
lon_lat_reg_str = f'{lon_lim[0]:3g},{lon_lim[1]:3g},{lat_lim[0]:3g},{lat_lim[1]:3g}'
self.lon_lat_reg_tk.set(lon_lat_reg_str)
self.make_new_axis()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment