mesmer.io.load_constant_files.load_phi_gc

mesmer.io.load_constant_files.load_phi_gc(lon, lat, ls, cfg, L_start=1500, L_end=10000, L_interval=250)

Loads or creates (if not available yet) distance matrix and Gaspari-Cohn correlation matrix.

Parameters
  • lon (dict) – longitude dictionary with key

    • [“c”] (1d array with longitudes at center of grid cell)

    • [“e”] (1d array with longitudes at edges of grid cells)

    • [“grid”] (2d array (lat,lon) of longitudes)

  • lat (dict) – latitude dictionary with key

    • [“c”] (1d array with latitudes at center of grid cell)

    • [“e”] (1d array with latitudes at edges of grid cells)

    • [“grid”] (2d array (lat,lon) of latitudes)

  • ls (dict) – land-sea dictionary with keys

    • [“grid_raw”] (2d array (lat,lon) of subsampled land fraction)

    • [“grid_no_ANT”] (grid_raw with Antarctica removed)

    • [“gp_l”] (1d array of fraction of land at land grid points)

    • [“grid_l”] (2d array (lat,lon) of fraction of land at land grid points)

    • [“idx_grid_l”] (2d boolean array (lat,lon) with land grid points = True for plotting on map)

    • [“grid_l_m”] (2d masked array (lat,lon) with ocean masked out for plotting on map)

    • [“wgt_gp_l”] (1d array of land area weights, i.e., area weight * land fraction)

  • cfg (module) – config file containing metadata

  • L_start (int, optional) – smallest localisation radius which is tested

  • L_end (int, optional) – largest localisation radius which is tested

  • L_interval (int, optional) – spacing interval between tested localisation radii

Returns

phi_gc (np.ndarray) – 2d array (gp, gp) of Gaspari-Cohn correlation matrix for grid points used for covariance localisation

Notes

  • If no complete number of L_intervals fits between L_start and L_end, L_intervals are repeated until the closest possible L value below L_end is reached.

  • L_end should not exceed 10’000 by much because eventually ValueError: the input matrix must be positive semidefinite in train_lv())