-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
Code Sample, a minimal, complete, and verifiable piece of code
I have a temperature grib message and I want to resample it using cubic resampling. However, i get these warnings in the console. If i lower the radius value I no longer get the warnings but I get 0s in the interpolated data.
UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
proj = self._crs.to_proj4(version=version)
RuntimeWarning: invalid value encountered in divide x_2 = (-b__ - np.sqrt(discriminant)) / (2 * a__)
import numpy as np
from pyproj import CRS
from pyresample.geometry import GridDefinition
from pyresample import create_area_def
from pyresample.bilinear import NumpyBilinearResampler
from pyresample import geometry
data = np.fromfunction(lambda y, x: y * x, (100, 100))
lons = np.fromfunction(lambda y, x: -180 + x * 3.6, (100, 100))
lats = np.fromfunction(lambda y, x: -90 + y * 1.8, (100, 100))
source_def = geometry.GridDefinition(lons=lons, lats=lats)
crs = CRS.from_epsg(3857) # EPSG code for WGS 84 / Pseudo-Mercator
target_def = create_area_def('my_area',
crs,
1000, 1000,
area_extent=[-180, -85, 180, 85],
units='degrees',
description='Target grid in Mercator projection')
resampler = NumpyBilinearResampler(source_def, target_def, radius_of_influence=200000)
interpolated_data = resampler.resample(data)
Thank you!
Metadata
Metadata
Assignees
Labels
No labels