Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting artifact with longitudes ranging from 0 to 360 degrees? #290

Open
ph-kev opened this issue Nov 18, 2024 · 0 comments
Open

Plotting artifact with longitudes ranging from 0 to 360 degrees? #290

ph-kev opened this issue Nov 18, 2024 · 0 comments

Comments

@ph-kev
Copy link

ph-kev commented Nov 18, 2024

I am not sure if this is an issue or if it is not supported by GeoMakie, but plotting data where the longitude ranges from 0 to 360 degrees differ from the same data ranging from -180 degrees to 180 degrees.

I am using landsea.nc from https://www.ncl.ucar.edu/Applications/Data/#cd and I ran the following script

using NCDatasets
using CairoMakie
using GeoMakie

# Get longitudes, latitudes, and mask data
nc = NCDataset("landsea.nc")
lat = nc["lat"][:]
lon = nc["lon"][:]
mask = nc["LSMASK"][:, :]

# Plot with longitudes ranging from 0 to 360 degrees
fig = Figure()
ax = GeoAxis(fig[1,1])
contourf!(ax, lon, lat, mask)
display(fig)

# Change longitudes to range from -180 to 180 degrees
lon[lon .> 180] .-= 360
sort_idx = sortperm(lon)
lon = lon[sort_idx]
mask = mask[sort_idx, :]

# Plot with longitudes ranging from -180 to 180 degrees
fig = Figure()
ax = GeoAxis(fig[1,1])
contourf!(ax, lon, lat, mask)
display(fig)

I get the following two images:
Image
Image

The second image is what I expected, but the first image is off. There is distortion at the top and bottom of the plot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant