-
Notifications
You must be signed in to change notification settings - Fork 213
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
Figure.solar crashes on Linux when drawing nautical terminator for 2024-04-16T06:00:00 #2959
Comments
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct. |
It works well for me, but I'm using macOS. Could you please add |
For me, it fails under Linux as reported, but it works under Windows. Output of
|
It looks like the issue is related to the import datetime
import pygmt
term_datetime = datetime.datetime(
year=2024,
month=4,
day=16,
hour=6,
minute=0, # fails with a fill color
# minute=1, # works with a fill color
second=0,
)
print(term_datetime)
fig = pygmt.Figure()
fig.coast(region="d", projection="W10c", shorelines=True, frame=True)
fig.solar(
terminator="nautical",
terminator_datetime=term_datetime,
# fill=None, # works
fill="blue", # fails
# pen="1p,red,solid", # works
)
fig.show() |
The equivalent GMT CLI is:
Could you please try if it fails for you on Linux? |
Yes, it fails with GMT 6.4 and 6.4.0_965606f_2022.03.14 on Linux.
|
Output of solar [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
solar [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
solar [DEBUG]: Reset MAP_ANNOT_OBLIQUE to anywhere
solar [DEBUG]: Projected values in meters: -1.80199e+07 1.80199e+07 -9.00996e+06 9.00996e+06
solar [DEBUG]: Computed automatic parameters using dimension scaling: 0.908088
solar [INFORMATION]: Map scale is 2402.66 km per cm or 1:2.40266e+08.
solar [DEBUG]: Running in PS mode modern
solar [DEBUG]: Use PS filename /home/{my_user_name}/.gmt/sessions/gmt_session.852013/gmt_1.ps-
solar [DEBUG]: Append to hidden PS file /home/{my_user_name}/.gmt/sessions/gmt_session.852013/gmt_1.ps-
solar [DEBUG]: Got session name as pygmt-session and default graphics formats as pdf
solar [DEBUG]: Basemap order: Frame = above Grid = above Tick/Annot = above
solar [DEBUG]: gmt_get_smallcircle: Added extra point at 0/-90.9758
solar [DEBUG]: gmt_get_smallcircle: Added extra point at 0/-89.0332
solar [DEBUG]: gmtlib_determine_pole: N = 363 Multiples of 360: 0 Residual: -1.27898e-13 Polygon contains south (CW) pole.
solar [INFORMATION]: Plot small circle with pole at 89.9329/10.3111 and radius 102 degrees
solar [DEBUG]: Polar cap: 1
solar [DEBUG]: Try to include S pole in polar cap path
solar [DEBUG]: West longitude = -180. East longitude = 180
solar [DEBUG]: gmtlib_determine_pole: N = 363 Multiples of 360: 0 Residual: -1.27898e-13 Polygon contains south (CW) pole.
solar [DEBUG]: First longitude = 89.9329. Last longitude = 89.9329
solar [DEBUG]: Crossing at -180,-90
solar [DEBUG]: k at point closest to lon -180 is = 0 [n = 363]
solar [DEBUG]: Created path from 180/-90 to 180/-90 [0 points]
solar [DEBUG]: Add perimeter data from k0->n [0->363], then 0->k0 [0]
solar [DEBUG]: Add path from -180/-90 to -180/-90 [0 points]
solar [DEBUG]: New path has 364 points, we allocated 363 points
malloc(): invalid size (unsorted)
Aborted (core dumped) Output of gmt solar -Rd -JW10c -Baf -Tn+d2024-04-16T06:00:00 -Gblue -png map malloc(): invalid size (unsorted)
Aborted (core dumped) |
It's likely an upstream bug, although I can't test if it has been fixed in the upcoming GMT 6.5.0 release. Ping @PaulWessel. |
Thanks @PaulWessel for immediately looking at this. So far, this issue appears to be OS-dependent: it works on Windows and macOS, but it fails on Linux. |
So we need someone with Linux to run that command in ddd for example and learn what the crash is and why. |
So it SEGVs in line 565? That is a calloc call but the message says malloc? What are the values of Belem and size? The message about size is invalid (unsorted) is strange was size is a scalar, no?? |
nelem=2048 and size=8. |
Does this debug message make sense to you?
As the OP says, using a slightly different time works:
|
Could you try on Linux to change line 9707 in gmt_plot.c to be
since perim_n is 0 this is a bit suspect. Does that help? |
Sorry, MAX of course |
Yes, |
See GenericMappingTools/pygmt#2959 for background. Ensure we add at least 1 point when going to pole.
See GenericMappingTools/pygmt#2959 for background. Ensure we add at least 1 point when going to pole.
The upstream bug has been fixed in the GMT's master branch and the working version GMT 6.5.0 will be released soon. |
Description of the problem
When I try to draw nautical terminator for year=2024, month=4, day=16, hour=6, minute=0, second=0, I got
malloc(): invalid size (unsorted) Aborted (core dumped)
There is no problem to draw it for other time, such as year=2024, month=4, day=16, hour=6, minute=1, second=0
Minimal Complete Verifiable Example
Full error message
System information
The text was updated successfully, but these errors were encountered: