slim4.tools
- class slim4.tools.VectorRotation(mesh, pnts)
Bases:
objectRotate vectors in long-lat projection to mesh projection
Initialization
Parameters: mesh – 2d slim4 mesh pnts – long-lat coordinates of points where velocity is computed
- rotate(u, v)
Rotate u and v
Parameters: u – eastward velocity v – northward velocity
- slim4.tools.abin_shrink(file_name, n_keep)
shrink the first dimension of abin/ameta files
- Return type:
None
- slim4.tools.boundary_nodes_global(mesh, tag)
- slim4.tools.dhms(t)
- slim4.tools.find_band_tri(mesh2d, tri_pass, size_band=2)
- slim4.tools.format_time(t, fmt=None)
- slim4.tools.get_current_mass(mesh, A, C)
- slim4.tools.get_current_mass_2d(mesh, H, C)
- slim4.tools.get_edges(mesh2d, boundaries)
- slim4.tools.get_flux(mesh, sw, tracer, dt, A, Q, C)
- slim4.tools.get_interpolation_weights(xyz, *dimarrays)
- slim4.tools.get_interpolation_weights_on_grid(mesh, gridx, gridy)
- slim4.tools.integral(mesh, sol)
- slim4.tools.integral_product(mesh, sol0, sol1)
- slim4.tools.interpolate_tif(filenames, x, y, projection, block_size=1024, band=0)
Interpolate a tiff file on a a set of points. The data is read by blocs of size block_size*block_size to reduce the memory usage.
- Parameters:
filenames (
Union[str,List[str]]) – path of list of paths to geotif(s) file(s) with the data to interpolate. Files are processed in order; earlier files take priority in overlapping areas.x (
ndarray) – the x coordinates of the points to interpolatey (
ndarray) – the y coordinates of the points to interpolateprojection (
str) – the projection of the points to interpolateblock_size (optional) – The size of the blocs. A bigger bloc is often faster but requires more memory. Defaults to 1024.
- Returns:
the interpolated data, same shape as x and y
- Return type:
NDArray
- slim4.tools.log(*args, **kwargs)
- Return type:
None
- slim4.tools.ncp2c(array, dtype=None, shape=None)
- slim4.tools.np2c(a, dtype=<class 'numpy.float64'>, shape=None)
- slim4.tools.parse_projection(proj)
- slim4.tools.parse_time(t, fmt=None)
- Return type:
float
- slim4.tools.prepro_discharge(filename, bath, boundaries, mesh, discharge, time)
The user gives the value of discharge as function of time, the updater goal is to calculate the correct transport value to the boundary as HQ/A. First, Q/A_(eta=0) is calculated. Then, to take the evolution of the cross section into account, a correction factor h/H is applied to Q/A_(eta=0). For the correct transport value we return directly Q*h/A_(eta=0)
- Parameters:
file (filename -- name of generated)
mesh (bath -- DG bathymetry on the whole)
names (boundaries -- list of boundary)
object (mesh -- slim2d.Mesh)
values (discharge -- discharge)
00 (time -- time (in seconds since 1970-01-01) – 00:00) of discharge values
- slim4.tools.prepro_discharge3d(path, z, boundaries, mesh, discharges, tracers, tracer_names, time, regroup=False)
Computes the transport value to the 3D boundary as HQ/A
- Parameters:
directory (path -- path to the prepro)
shape (z -- array of mesh z values with)
names (tracer_names -- list of tracer)
object (mesh -- slim3d.Mesh)
values (discharges -- list of lists of discharge)
lists (tracers -- list of) – The first two must be temperature and salinity (order matters)
names
00 (time -- time (in seconds since 1970-01-01) – 00:00) of discharge values
True (regroup -- if)
variable (group additional tracers 3 by 3 as fields of the same tracer)
- slim4.tools.read_polygons_shp(mesh, filename, id_field_name=None, return_area=False)
- slim4.tools.visualize_prepro_data(datafile, variables, name, mesh, time=None)
- slim4.tools.visualize_prepro_data3d(datafile, variables, name, mesh3d, z, time=None)
- slim4.tools.xdmf_abin_shrink(file_name, n_keep)
- Return type:
None