varunayan.processing.data_filter module#
- varunayan.processing.data_filter.filter_netcdf_by_shapefile(ds: Dataset, geojson_data: Dict[str, Any]) DataFrame [source]#
Filter a NetCDF dataset to only include grid points that fall within the GeoJSON polygon(s). Internally handles multi-feature GeoJSONs by matching points to each feature individually, then taking the union of all matched points.
- Parameters:
ds – xarray Dataset
geojson_data – Loaded GeoJSON (as dict or GeoDataFrame)
- Returns:
A pandas DataFrame with filtered points.
- varunayan.processing.data_filter.get_unique_coordinates_in_polygon(ds: Dataset, geojson_data: Dict[str, Any]) DataFrame [source]#
Alternative helper function that returns just the unique lat/lon pairs inside the polygon. This can be useful for other operations or caching coordinate filtering results.