grids
Functions
|
Interpolates unstructured data to a structured grid, handling NaNs in z-values |
|
Determines whether the latitude and longitude points form a structured grid. |
Module Contents
- grids.interpolate_unstructured(x, y, z, resolution=1000, method='linear')
Interpolates unstructured data to a structured grid, handling NaNs in z-values and preventing interpolation across large gaps.
Parameters: - x: 1D array of x-coordinates. - y: 1D array of y-coordinates. - z: 1D array of z values. - resolution: The number of points along each axis for the structured grid. - method: Interpolation method (‘linear’, ‘nearest’, ‘cubic’). - gap_threshold: The distance threshold beyond which interpolation is not performed (set to NaN).
Returns: - grid_x: 2D grid of x-coordinates. - grid_y: 2D grid of y-coordinates. - grid_z: 2D grid of interpolated z-values, with NaNs in large gap regions.
- grids.is_structured(lat, lon, tol=1e-05)
Determines whether the latitude and longitude points form a structured grid.
Parameters: - lat: A 1D or 2D array of latitude points. - lon: A 1D or 2D array of longitude points. - tol: Tolerance for floating-point comparison (default 1e-5).
Returns: - True if the data is structured (grid), False if it’s unstructured.