Skip to content

Commit

Permalink
Merge pull request #184 from FESOM/workbench
Browse files Browse the repository at this point in the history
Workbench
  • Loading branch information
patrickscholz authored Nov 18, 2024
2 parents 3f95ffa + 79a7c0a commit f1a489d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 50 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<p align="center" width="100%">
<img width=75% src="docs/images/tripyview_hslice_streaml.png">
Expand Down
9 changes: 5 additions & 4 deletions templates_notebooks/template_hslice_quiver.ipynb

Large diffs are not rendered by default.

48 changes: 2 additions & 46 deletions tripyview/sub_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit f1a489d

Please sign in to comment.