NEDAS.models.nextsim.dg.perturb module

NEDAS.models.nextsim.dg.perturb.gen_perturb(grid: RegularGrid, perturb_type: Literal['gaussian'], amp: float, hcorr: int) ndarray[source]

get random perturbation fields

Parameters:
  • grid (RegularGrid) – regular grid object for the 2D domain

  • perturb_type (Literal['gaussian']) – type of perturbation method

  • amp (float) – amplitude of the perturbation

  • hcorr (float) – horizontal decorrelation length scale in grid points

  • powerlaw (float, optional) – power law exponent, by default -3.

Returns:

random perturbation field

Return type:

np.ndarray

NEDAS.models.nextsim.dg.perturb.apply_AR1_perturb(perturb: ndarray, tcorr: float = 1.0, prev_perturb: None | ndarray = None) ndarray[source]

apply AR1 perturbation to the field

Parameters:
  • perturb (np.ndarray) – perturbation field

  • tcorr (float, optional) – time correlation length, by default 1.0

  • prev_perturb (Union[None, np.ndarray], optional) – previous perturbation field, by default None

NEDAS.models.nextsim.dg.perturb.apply_perturb(grid: RegularGrid, field: ndarray, perturb: ndarray, perturb_type: Literal['gaussian']) ndarray[source]

apply perturbation to the field

Parameters:
  • grid (RegularGrid) – grid object for the 2D domain

  • field (np.ndarray) – field to be perturbed

  • perturb (np.ndarray) – perturbation field

  • perturb_type (Literal['gaussian']) – type of perturbation method

Returns:

perturbed field

Return type:

np.ndarray

NEDAS.models.nextsim.dg.perturb.random_field_gaussian(nx: int, ny: int, amplitude: float, hcorr: int) ndarray[source]

generate a 2D random field with Gaussian correlation length scale with given amplitude.

Parameters:
  • nx (int) – number of grid points in x direction

  • ny (int) – number of grid points in y direction

  • amplitude (float) – amplitude of the random field

  • hcorr (int) – horizontal correlation length scale in grid points

Returns:

2D random field with Gaussian correlation length scale

Return type:

np.ndarray

NEDAS.models.nextsim.dg.perturb.pres_adjusted_wind_perturb(grid: RegularGrid, ampl_pres: float, ampl_wind: float, scorr: float, pres: ndarray, with_wind_speed_limit: bool = True, wlat: float = 15.0) tuple[ndarray, ndarray][source]

generate a random perturbation for wind u,v by pressure perturbation.

Parameters:
  • grid (RegularGrid) – grid object for the 2D domain

  • ampl_pres (float) – amplitude of pressure perturbations (Pa)

  • ampl_wind (float) – amplitude of wind perturbations (m/s)

  • scorr (float) – horizontal decorrelation length scale by number of grid points

  • pres (np.ndarray) – pressure field perturbations

  • with_wind_speed_limit (bool, optional) – if true: limit pressure perturbation by wind speed to account for horizontal scale of perturbation, by default True. This option will force pres_wind_relate to be True.

  • wlat (float, optional) – latitude bound for pure geostroph wind, by default 15.

Returns:

pressure perturbation, u wind perturbation, v wind perturbation

Return type:

tuple