From 281b3ab0add53006bacaa189a9d60f6f4e6181c8 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 18 Nov 2024 11:10:13 +0100 Subject: [PATCH] update readme --- README.md | 1 + .../template_hslice_quiver.ipynb | 9 ++-- tripyview/sub_plot.py | 48 +------------------ 3 files changed, 8 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index b1b56fd..90bd5fb 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ vertice/element- resolution and area) * `hslice_clim_np` - plot horizontal slices of temperature, salinity and density climatology in north polar stereographic projection * `hslice_clim_sp` - plot horizontal slices of temperature, salinity and density climatology in south polar stereographic projection * `hslice_isotdep` - plot horizontal slices of depth of distinct isotherm (default: 12°C isotherm) +* `hslice_quiver` - plot horizontal slices of scalar ocean variable and overlay quiver vector information from regular gridded coarse grained velocity data * `hslice_streaml` - plot horizontal slices of scalar ocean variable and overlay streamline information from regular gridded coarse grained velocity data

diff --git a/templates_notebooks/template_hslice_quiver.ipynb b/templates_notebooks/template_hslice_quiver.ipynb index 92880f2..d7945ee 100644 --- a/templates_notebooks/template_hslice_quiver.ipynb +++ b/templates_notebooks/template_hslice_quiver.ipynb @@ -476,7 +476,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 56, "metadata": { "scrolled": false, "slideshow": { @@ -1473,7 +1473,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -1495,8 +1495,9 @@ "output_type": "stream", "text": [ "--> cmin/cmax: norm: -1.897991/21.301758, hist: -1.445596/20.315769, fin: -1.445596/20.315769\n", - "{'cstr': 'blue2red', 'cnum': 15, 'chist': True, 'ctresh': 0.995, 'cnlab': 8, 'cmin': -1.45, 'cmax': 20.32, 'cref': 10.0, 'cmap': , 'clevel': array([-2., -1., 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.,\n", - " 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21.]), 'clab': array([-2., 1., 4., 7., 10., 13., 16., 19.])}\n" + "{'cstr': 'blue2red', 'cnum': 15, 'chist': True, 'ctresh': 0.995, 'cnlab': 8, 'cmin': -1.45, 'cmax': 20.32, 'cref': 10.0, 'cmap': , 'clevel': array([-2., -1., 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.,\n", + " 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21.]), 'clab': array([-2., 1., 4., 7., 10., 13., 16., 19.])}\n", + " > save figure: /albedo/home/pscholz/tripyview/Results/test_quiv/temp_rob_y1979-2019_dep250m.png\n" ] } ], diff --git a/tripyview/sub_plot.py b/tripyview/sub_plot.py index 97dc324..a57722c 100755 --- a/tripyview/sub_plot.py +++ b/tripyview/sub_plot.py @@ -5150,48 +5150,8 @@ def do_plt_quiver_reg(hax_ii, ii, do_quiver, quiver_dat=None, quiver_opt=dict(), data_x, data_y = data_x[mask_nan], data_y[mask_nan] data_u, data_v, data_s = data_u[mask_nan], data_v[mask_nan], data_s[mask_nan] - ##_______________________________________________________________________ - ## try to do scaling projection space dependent - ## Define the geographic coordinates bounding the area of interest - #min_x, max_x = hax_ii.get_xlim() - #min_y, max_y = hax_ii.get_ylim() - #ddx , ddy = max_x-min_x , max_y-min_y - - #min_x += ddx*0.025 - #min_y += ddy*0.025 - #max_x -= ddx*0.025 - #max_y -= ddy*0.025 - - ## Transform the minimum and maximum points - #min_lon, dum = ccrs.PlateCarree().transform_point(min_x, (min_y+max_y)/2, src_crs=hax_ii.projection) - #max_lon, dum = ccrs.PlateCarree().transform_point(max_x, (min_y+max_y)/2, src_crs=hax_ii.projection) - #dum, min_lat = ccrs.PlateCarree().transform_point((min_x+max_x)/2, min_y, src_crs=hax_ii.projection) - #dum, max_lat = ccrs.PlateCarree().transform_point((min_x+max_x)/2, max_y, src_crs=hax_ii.projection) - - ## Calculate the distance in kilometers using the scale factor - #dlon = np.abs(max_lon - min_lon) # Convert meters to kilometers - #dlat = np.abs(max_lat - min_lat) # Convert meters to kilometers - - #dy = dlat*np.pi*6371/180 - #dx = dlon*np.pi*6371/180*np.cos(np.deg2rad( (min_lat+max_lat)/2 )) - #_______________________________________________________________________ - # add quiver plot - #max_dim = np.min([dx,dy])*10 - #if quiv_scalfac is not None: quiv_scalfac = 1/max_dim/quiv_scalfac - #if quiv_arrwidth is not None: quiv_arrwidth = max_dim*quiv_arrwidth - - quiv_optdefault=dict({}) - #quiv_optdefault=dict({'edgecolor':'k', - #'linewidth':0.10, - #'width': quiv_arrwidth , - #'units':'xy', - #'scale_units':'xy', - #'angles':'xy', - #'scale': quiv_scalfac}) - quiv_optdefault=dict({ - #'angles':"xy", 'scale_units':"xy", 'scale':4, 'minshaft':2, 'minlength':0.5, @@ -5201,12 +5161,8 @@ def do_plt_quiver_reg(hax_ii, ii, do_quiver, quiver_dat=None, quiver_opt=dict(), data_u, data_v = hax_ii.projection.transform_vectors(which_transf, data_x, data_y, data_u, data_v) data_x, data_y = hax_ii.projection.transform_points( which_transf, data_x, data_y)[:,0:2].T - h0=hax_ii.quiver(data_x, data_y, - data_u, data_v, - color = 'k', - zorder=10, - **quiv_optdefault, - ) + h0=hax_ii.quiver(data_x, data_y, data_u, data_v, + color = 'k', zorder=10, **quiv_optdefault, ) #_______________________________________________________________________ # make a streamline legend