Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seam where longitude wraps around in matplotlib/cartopy Mollweide projection

I am plotting some NETCDF data, handled by xarray in Matplotlib using a Cartopy wrapper for the map projections. When I produce a filled contour plot (contourf), I end up with a 'seam' at longitude zero (where my data longitudes begin and end). Is there an in-line way to interpolate between longitude[-1] and longitude[0], perhaps by treating the data as periodic or something?

Please see the attached graphic for an example:

enter image description here

like image 334
Rutherford Hayes Avatar asked Oct 12 '25 04:10

Rutherford Hayes


1 Answers

You should add a cyclic point to your data array and its longitude coordinate using the add_cyclic_point function: .

like image 142
ajdawson Avatar answered Oct 14 '25 18:10

ajdawson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!