Upscaling module

Python module to upscale different property fields such as hydraulic conductivity on regular and irregular grids

uppy.f_2D(a, dx=None, dy=None, direction='x', type='series')

Function to operate a mean row or column wise by pairs of rows or columns

uppy.f_3D(a, dx=None, dy=None, dz=None, direction='x', typ='x')

Function to operate a mean between two 2D fields from a 3D field

Parameters:
  • a (3D numpy array) – The 3D field

  • direction (str) – The direction of the mean to compute. Can be “x”, “y” or “z”

  • type (str) – The direction where fields are selected. Can be “x”, “y” or “z”

uppy.f_rt_simple(kxx, kyy, kzz, dx, dy, dz)
uppy.f_sr(kxx, kyy, kzz, dx, dy, dz, direction='x')
uppy.f_sr_center(kxx, kyy, kzz, dx, dy, dz)
uppy.fill_nan_values_with_gmean(a)

Function to fill nan values with the geometric mean of the non-nan values

uppy.find_c_2D(k_field, dx=None, dy=None, direction='x', first_type='series')
uppy.find_c_3D(k_field, direction='x', typ='min', dx=None, dy=None, dz=None)
uppy.get_alpha(dx, dy, dz=None, direction='x')
uppy.get_idx(i)
uppy.gmean(a)
uppy.hmean(v1, v2, w1=1, w2=1)
uppy.keq(cmin, cmax, alpha)
uppy.mean(v1, v2, w1=1, w2=1)
uppy.merge(v1, v2, w1, w2, normalize=True)

Function to merge two vectors v1 and v2 with weights w1 and w2 Is used here to merge two columns of different sizes

uppy.rotate_point(p1, angle, origin=(0, 0))
uppy.simplified_renormalization(field, dx, dy, dz, direction='x')
uppy.simplified_renormalization_2D(field, dx, dy, direction='x')
uppy.standard_renormalization(field_xx, field_yy, field_zz, dx, dy, dz, niter=1, scheme='direct')
uppy.tensorial_renormalization(field_xx, field_yy, field_zz, dx, dy, dz, niter=1)
uppy.test_f()

Test the function f

uppy.test_f_2D()

Test the function f

uppy.test_find_c()
uppy.upscale_cell_disv(grid_ref_xver, grid_ref_yver, grid_ref_layers, grid_ref_top, sx_grid, sy_grid, sz_grid, field, x1_cell, x2_cell, y1_cell, y2_cell, z1_cell=None, z2_cell=None, method='simplified_renormalization')

Upscale a cell value to a cell with a different size. Note that cell must be a cube.

Parameters:
  • grid_ref_xver (np.ndarray) – x-vertices of the reference grid.

  • grid_ref_yvert (np.ndarray) – y-vertices of the reference grid.

  • grid_ref_layers (1D np.ndarray) – height of the layers of the reference grid.

  • grid_ref_top (float) – top of the reference grid.

  • field (np.ndarray) – K field to be upscaled. can be 2D or 3D.

  • x1_cell (float) – minimal x-coordinate of the cell.

  • x2_cell (float) – maximal x-coordinate of the cell.

  • y1_cell (float) – minimal y-coordinate of the cell.

  • y2_cell (float) – maximal y-coordinate of the cell.

  • z1_cell (float) – minimal z-coordinate of the cell.

  • z2_cell (float) – maximal z-coordinate of the cell.

uppy.upscale_k(field, dx=1, dy=1, dz=1, ox=0, oy=0, oz=0, method='simplified_renormalization_C', factor_x=2, factor_y=2, factor_z=2, grid=None, scheme='center')

Function to upscale a field using renormalization methods and average methods

Parameters:
  • field (np.ndarray) – 3D isotropic hydraulic conductivity field

  • dx (float or np.ndarray) – Cell size of original field in the x direction

  • dy (float or np.ndarray) – Cell size of original field in the y direction

  • dz (float or np.ndarray) – Cell size of original field in the z direction

  • ox (float) – Origin of the field (lower left corner) in the x direction

  • oy (float) – Origin of the field (lower left corner) in the y direction

  • oz (float) – Origin of the field (lower left corner) in the z direction

  • method (str) – Renormalization method. Options are simplified_renormalization, standard_renormalization, tensorial_renormalization, arithmetic, harmonic and geometric

  • factor_x (int) – Upscaling factor in the x direction. This means that the new field will have a shape divided by factor_x in the x direction Must be a power of 2 for standard and tensorial renormalization. It should be noted that field shape in the x direction must be a multiple of factor_x

  • factor_y (int) – Upscaling factor in the y direction. This means that the new field will have a shape divided by factor_y in the y direction Must be a power of 2 for standard and tensorial renormalization. It should be noted that field shape in the y direction must be a multiple of factor_y

  • factor_z (int) – Upscaling factor in the z direction. This means that the new field will have a shape divided by factor_z in the z direction Must be a power of 2 for standard and tensorial renormalization. It should be noted that field shape in the z direction must be a multiple of factor_z

  • grid (np.ndarray) – Modflow dis grid. Only works with simplified_renormalization, arithmetic, harmonic and geometric. Not implemented yet.

  • scheme (str) – Scheme for standard renormalization. Options are direct and center. Center is generally more accurate and faster. Default is center

uppy.upscale_k_2D(field, dx=1, dy=1, ox=0, oy=0, method='simplified_renormalization', factor_x=2, factor_y=2, grid=None)

Function to upscale a field using renormalization methods and average methods

Parameters:
  • field (np.ndarray) – 3D isotropic hydraulic conductivity field

  • dx (float or np.ndarray) – Cell size of original field in the x direction. If you choose simplified_renormalization_C, dx must a 1D vector of size field.shape[1]

  • dy (float or np.ndarray) – Cell size of original field in the y direction. If you choose simplified_renormalization_C, dy must a 1D vector of size field.shape[0]

  • ox (float) – Origin of the field (lower left corner) in the x direction

  • oy (float) – Origin of the field (lower left corner) in the y direction

  • method (str) – Renormalization method. Options are simplified_renormalization, arithmetic, harmonic and geometric

  • factor_x (int) – Upscaling factor in the x direction. This means that the new field will have a shape divided by factor_x in the x direction Must be a power of 2 for standard and tensorial renormalization. It should be noted that field shape in the x direction must be a multiple of factor_x

  • factor_y (int) – Upscaling factor in the y direction. This means that the new field will have a shape divided by factor_y in the y direction Must be a power of 2 for standard and tensorial renormalization. It should be noted that field shape in the y direction must be a multiple of factor_y

  • factor_z (int) – Upscaling factor in the z direction. This means that the new field will have a shape divided by factor_z in the z direction Must be a power of 2 for standard and tensorial renormalization. It should be noted that field shape in the z direction must be a multiple of factor_z

  • grid (np.ndarray) – Modflow dis grid. Only works with simplified_renormalization, arithmetic, harmonic and geometric. Not implemented yet.