Closed seisman closed 6 months ago
Just looked at this and for me, the problematic part of the datetime tutorial seem to be the first example. Interestingly, the error does not occur when the symbol style="x0.3c"
is changed to something else, e.g., style="c0.3c"
(see also commit https://github.com/GenericMappingTools/pygmt/pull/2760/commits/0ce220416c7b22751775ab4f4ec43acacb735c19).
import datetime
import pygmt
x = [
datetime.date(2010, 6, 1),
datetime.date(2011, 6, 1),
datetime.date(2012, 6, 1),
datetime.date(2013, 6, 1),
]
y = [1, 2, 3, 5]
fig = pygmt.Figure()
fig.plot(
projection="X10c/5c",
region=[datetime.date(2010, 1, 1), datetime.date(2014, 12, 1), 0, 6],
frame=["WSen", "afg"],
x=x,
y=y,
style="x0.3c", # Fails
#style="c0.3c", # Works
pen="1p",
# verbose="d",
)
fig.show()
Error message:
psconvert [ERROR]: System call [@"C:\Program Files\gs\gs9.21\bin\gswin64c.exe" -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/Admin/.gmt/sessions/gmt_session.4d4c1fb070b944e58b2121beda1d21f0/gmt_7.ps-" 2> "C:/Users/Admin/.gmt/sessions/gmt_session.4d4c1fb070b944e58b2121beda1d21f0/psconvert_15488c.bb"] returned error 1.
Traceback (most recent call last):
File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)
File c:\users\admin\c2\eigenedokumente\studium\promotion\e_gmt\00_testing\001_gmt_pygmt\issue_date_tut\issue_date_tut.py:27
fig.show()
File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pygmt\figure.py:462 in show
png = self._preview(
File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pygmt\figure.py:495 in _preview
self.savefig(fname, dpi=dpi, **kwargs)
File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pygmt\figure.py:374 in savefig
self.psconvert(prefix=prefix, fmt=fmt, crop=crop, **kwargs)
File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pygmt\helpers\decorators.py:603 in new_module
return module_func(*args, **kwargs)
File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pygmt\helpers\decorators.py:776 in new_module
return module_func(*bound.args, **bound.kwargs)
File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pygmt\figure.py:252 in psconvert
lib.call_module(
File C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\Lib\site-packages\pygmt\clib\session.py:624 in call_module
raise GMTCLibError(
GMTCLibError: Module 'psconvert' failed with status code 79:
psconvert [ERROR]: System call [@"C:\Program Files\gs\gs9.21\bin\gswin64c.exe" -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/Admin/.gmt/sessions/gmt_session.4d4c1fb070b944e58b2121beda1d21f0/gmt_7.ps-" 2> "C:/Users/Admin/.gmt/sessions/gmt_session.4d4c1fb070b944e58b2121beda1d21f0/psconvert_15488c.bb"] returned error 1.
Error: /limitcheck in -file-
Operand stack:
1.68e-22 0.0
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1983 1 3 %oparray_pop 1982 1 3 %oparray_pop 1966 1 3 %oparray_pop 1852 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push
Dictionary stack:
--dict:1204/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)-- --dict:157/250(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 21747
Output of V="d"
:
pygmt-session [DEBUG]: Use PS filename C:/Users/Admin/.gmt/sessions/gmt_session.9a637b98aa6f4eb0bc41da0f441a997b/gmt_1.ps-
pygmt-session [DEBUG]: gmtinit_get_current_panel: No current panel selected so not in subplot mode
pygmt-session [DEBUG]: Revised options: @GMTAPI@-S-I-D-V-T-N-000000 -BWSen -Bafg -JX10c/5c -R2010-01-01/2014-12-01/0/6 -Sx0.3c -Vd -W1p
plot [DEBUG]: History: Process -JX10c/5c
plot [DEBUG]: History: Process -R2010-01-01/2014-12-01/0/6
plot [INFORMATION]: GMT_Parse_Options: Interval-setting -B options were reordered to appear before axis and frame -B options to ensure proper parsing.
plot [INFORMATION]: GMT_Parse_Options: New option order: @GMTAPI@-S-I-D-V-T-N-000000 -JX10c/5c -R2010-01-01/2014-12-01/0/6 -Sx0.3c -Vd -W1p -Bafg -BWSen
plot [DEBUG]: Got regular w/e/s/n for region (2010-01-01/2014-12-01/0/6)
plot [INFORMATION]: Processing input table data
plot [DEBUG]: Operation will require 2 input columns [n_cols_start = 2]
plot [DEBUG]: Reset MAP_ANNOT_OBLIQUE to anywhere
plot [DEBUG]: Projected values in meters: 1.2623e+09 1.41739e+09 0 6
plot [INFORMATION]: Linear projection implies y-axis distance exaggeration relative to the x-axis by a factor of 1.2924e+07
plot [DEBUG]: Computed automatic parameters using dimension scaling: 0.860948
plot [DEBUG]: Auto-frame interval for axis 0 item 0: d = 2 f = 1
plot [INFORMATION]: Auto-frame interval for x-axis (item 0): a2Yf1Yg2Y
plot [DEBUG]: Auto-frame interval for axis 1 item 0: d = 2 f = 1
plot [INFORMATION]: Auto-frame interval for y-axis (item 0): a2f1g2
plot [INFORMATION]: Map scale is 15508.8 km per cm or 1:1.55088e+09.
plot [DEBUG]: Running in PS mode modern
plot [DEBUG]: Use PS filename C:/Users/Admin/.gmt/sessions/gmt_session.9a637b98aa6f4eb0bc41da0f441a997b/gmt_1.ps-
plot [DEBUG]: Create hidden PS file C:/Users/Admin/.gmt/sessions/gmt_session.9a637b98aa6f4eb0bc41da0f441a997b/gmt_1.ps-
plot [DEBUG]: Got session name as pygmt-session and default graphics formats as pdf
plot [DEBUG]: Basemap order: Frame = above Grid = below Tick/Annot = below
plot [DEBUG]: Entering gmtplot_map_gridlines
plot [INFORMATION]: Save current gridline information to gmt.history
plot [DEBUG]: Draw y = 0 from 1.2623e+09 to 1.41739e+09
plot [DEBUG]: Draw y = 2 from 1.2623e+09 to 1.41739e+09
plot [DEBUG]: Draw y = 4 from 1.2623e+09 to 1.41739e+09
plot [DEBUG]: Draw y = 6 from 1.2623e+09 to 1.41739e+09
plot [DEBUG]: Exiting gmtplot_map_gridlines
plot [DEBUG]: gmtapi_init_import: Passed family = Data Table and geometry = Point
plot [DEBUG]: gmtapi_init_import: Added 1 new sources
plot [DEBUG]: GMT_Init_IO: Returned first Input object ID = 0
plot [DEBUG]: GMT_Begin_IO: Mode value 1 not considered (ignored)
plot [DEBUG]: GMT_Begin_IO: Initialize record-by-record access for Input
plot [DEBUG]: gmtapi_next_io_source: Selected object 0
plot [INFORMATION]: Reading Data Table from Input memory location via vector
plot [DEBUG]: GMT_Begin_IO: Input resource access is now enabled [record-by-record]
plot [DEBUG]: GMT_End_IO: Input resource access is now disabled
plot [DEBUG]: Current size of half-baked PS file C:/Users/Admin/.gmt/sessions/gmt_session.9a637b98aa6f4eb0bc41da0f441a997b/gmt_1.ps- = 23528.
psconvert [ERROR]: System call [@"C:\Program Files\gs\gs9.21\bin\gswin64c.exe" -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/Admin/.gmt/sessions/gmt_session.9a637b98aa6f4eb0bc41da0f441a997b/gmt_1.ps-" 2> "C:/Users/Admin/.gmt/sessions/gmt_session.9a637b98aa6f4eb0bc41da0f441a997b/psconvert_20664c.bb"] returned error 1.
Output of pygmt.show_versions()
:
pygmt.show_versions()
PyGMT information:
version: v0.11.0
System information:
python: 3.12.1 | packaged by conda-forge | (main, Dec 23 2023, 07:53:56) [MSC v.1937 64 bit (AMD64)]
executable: C:\ProgramData\Anaconda3\envs\pygmt_env_dev_650\python.exe
machine: Windows-10-10.0.19045-SP0
Dependency information:
numpy: 1.26.3
pandas: 2.1.4
xarray: 2023.12.0
netCDF4: 1.6.5
packaging: 23.2
contextily: 1.5.0
geopandas: 0.14.2
ipython: None
rioxarray: 0.15.0
ghostscript: 10.02.1
GMT library information:
binary version: 6.5.0
cores: 4
grid layout: rows
image layout:
library path: C:/ProgramData/Anaconda3/envs/pygmt_env_dev_650/Library/bin/gmt.dll
padding: 2
plugin dir: C:/ProgramData/Anaconda3/envs/pygmt_env_dev_650/Library/bin/gmt_plugins
share dir: C:/Program Files (x86)/gmt6/share
version: 6.5.0
Could you please try if it also fails with the equivalent GMT CLI version?
Could you please try if it also fails with the equivalent GMT CLI version?
I tried the following code with GMT using this input data data_dates_test.txt
gmt begin
gmt basemap -JX10c/5c -R2010-01-01/2014-12-01/0/6 -BWSen -Bafg
gmt plot data_dates_test.txt -Sx0.3c -W1p
gmt end show
And it works, but it fails with PyGMT under Windows.
Actually, all line symbols (x
, y
, -
, +
) are not working for the first example in this tutorial. However, for the other examples in the tutorial, this is not the case.
Could you please run the script in https://github.com/GenericMappingTools/pygmt/issues/3038#issuecomment-1926439808 in IPython or Jupyter Notebook again, but skip the fig.show()
call? If you have verbose="d"
, you should see a line like the below at the end of the output (please note that the actual path may be different):
plot [DEBUG]: Current size of half-baked PS file C:/Users/Admin/.gmt/sessions/gmt_session.9a637b98aa6f4eb0bc41da0f441a997b/gmt_1.ps- = 23528.
Could you please upload the gmt_1.ps-
file so that I can compare it with the one on macOS/Linux? Please note that GitHub doesn't allow .ps-
file extension, so you need to either create a zip file or change the file extension to .txt
.
Could you please run the script in #3038 (comment) in IPython or Jupyter Notebook again, but skip the
fig.show()
call? If you haveverbose="d"
, you should see a line like the below at the end of the output (please note that the actual path may be different):plot [DEBUG]: Current size of half-baked PS file C:/Users/Admin/.gmt/sessions/gmt_session.9a637b98aa6f4eb0bc41da0f441a997b/gmt_1.ps- = 23528.
Could you please upload the
gmt_1.ps-
file so that I can compare it with the one on macOS/Linux? Please note that GitHub doesn't allow.ps-
file extension, so you need to either create a zip file or change the file extension to.txt
.
I have done this. Here is this file: gmt_1.ps-.txt
Thanks @yvonnefroehlich. I compared your Windows/failing version and my macOS/working version. The Windows version has one more line that cause troubles:
$ diff gmt_1.ps- gmt_1.ps-.txt
8c8
< %%CreationDate: Tue Feb 6 17:46:43 2024
---
> %%CreationDate: Mon Feb 5 21:17:49 2024
745a746
> 1.68e-22 2.04e-153 5.47e+160 C
Ping @PaulWessel for help.
I am wondering whether we should update this tutorial in the meanwhile?
I am wondering whether we should update this tutorial in the meanwhile?
Yes, better to have a working example.
I am wondering whether we should update this tutorial in the meanwhile?
Yes, better to have a working example.
I submitted PR #3121 to change the symbol from x
(crosses) to c
(circles).
Closed by #3121, thanks!
Hm, I am not 100 % sure about closing this issue as completed. Strictly speaking, PR #3121 is not a fix for this problem, as the symbol was changed from x
to c
to make this example working under Windows. However, it should be possible to use line symbols with this code example.
Confirmed upstream bug and fixed in https://github.com/GenericMappingTools/gmt/pull/8410. Closing.
The "Docs" CI is consistently failing on Windows, with following error:
It's likely an upstream bug in GMT 6.5. We need a Windows developer to run this tutorial and see if more information can be provided.