-
Notifications
You must be signed in to change notification settings - Fork 243
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Description of the problem
I recently updated to pygmt v0.5.0 (cloned my v.0.4.0 environment then ran: conda update pygmt) and now I'm having an issue with pygmt.plot when trying to plot shapefiles. Below is an example of a script which works fine in my v.0.4.0 env but produces the below error with v0.5.0.
This error happens with any shapefiles I've tried. Here's a link to this specific one: https://doi.pangaea.de/10.1594/PANGAEA.819147
Full code that generated the error
import pygmt
figheight=180 # in mm
# for Ross Ice Shelf
ris_xl=-660_000
ris_yl=-1_500_000
ris_xh=470_000
ris_yh=-400_000
# Calculate the figure width and map scale
figwidth=figheight*(ris_xh-ris_xl)/(ris_yh-ris_yl)
risratio = (ris_yh - ris_yl) / (figheight/1000)
# Make a GMT region string and projection strings in both PS71 and Lon/Lat
risreg = str(ris_xl) + '/' + str(ris_xh) + '/' + str(ris_yl) + '/' + str(ris_yh) #W/E/S/N
risproj = "x1:" + str(risratio)
risproj_ll = "s0/-90/-71/1:" + str(risratio)
fig = pygmt.Figure()
# Plot Shapefiles
fig.plot(data='../PyGMT/Venturelli2020/scripps_antarctica_polygons_v1.shp', region = risreg, projection = risproj, pen = '0.5p,black')
fig.show()Full error message
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-8-1bd9f90ba3c5> in <module>
20
21 # Plot Shapefiles
---> 22 fig.plot(data='../PyGMT/Venturelli2020/scripps_antarctica_polygons_v1.shp', region = risreg, projection = risproj, pen = '0.5p,black')
23
24 fig.show()
~\Anaconda3\envs\pygmt05\lib\site-packages\pygmt\helpers\decorators.py in new_module(*args, **kwargs)
803 warnings.warn(msg, category=FutureWarning, stacklevel=2)
804 kwargs[newname] = kwargs.pop(oldname)
--> 805 return module_func(*args, **kwargs)
806
807 return new_module
~\Anaconda3\envs\pygmt05\lib\site-packages\pygmt\helpers\decorators.py in new_module(*args, **kwargs)
803 warnings.warn(msg, category=FutureWarning, stacklevel=2)
804 kwargs[newname] = kwargs.pop(oldname)
--> 805 return module_func(*args, **kwargs)
806
807 return new_module
~\Anaconda3\envs\pygmt05\lib\site-packages\pygmt\helpers\decorators.py in new_module(*args, **kwargs)
871 )
872 warnings.warn(msg, category=FutureWarning, stacklevel=2)
--> 873 return module_func(*args, **kwargs)
874
875 return new_module
~\Anaconda3\envs\pygmt05\lib\site-packages\pygmt\helpers\decorators.py in new_module(*args, **kwargs)
584 )
585 warnings.warn(msg, category=SyntaxWarning, stacklevel=2)
--> 586 return module_func(*args, **kwargs)
587
588 new_module.aliases = aliases
~\Anaconda3\envs\pygmt05\lib\site-packages\pygmt\helpers\decorators.py in new_module(*args, **kwargs)
724 kwargs[arg] = separators[fmt].join(f"{item}" for item in value)
725 # Execute the original function and return its output
--> 726 return module_func(*args, **kwargs)
727
728 return new_module
~\Anaconda3\envs\pygmt05\lib\site-packages\pygmt\src\plot.py in plot(self, data, x, y, size, direction, **kwargs)
235 try:
236 with open(which(data), mode="r", encoding="utf8") as file:
--> 237 line = file.readline()
238 if (
239 "@GMULTIPOINT" in line or "@GPOINT" in line
~\Anaconda3\envs\pygmt05\lib\codecs.py in decode(self, input, final)
320 # decode input (taking the buffer into account)
321 data = self.buffer + input
--> 322 (result, consumed) = self._buffer_decode(data, self.errors, final)
323 # keep undecoded input until the next call
324 self.buffer = data[consumed:]
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8d in position 26: invalid start byte
System information
Please paste the output of python -c "import pygmt; pygmt.show_versions()":
PyGMT information:
version: v0.5.0
System information:
python: 3.8.10 | packaged by conda-forge | (default, May 11 2021, 06:25:23) [MSC v.1916 64 bit (AMD64)]
executable: C:\Users\matthewt\Anaconda3\envs\pygmt05\python.exe
machine: Windows-10-10.0.17134-SP0
Dependency information:
numpy: 1.20.3
pandas: 1.2.4
xarray: 0.18.2
netCDF4: 1.5.7
packaging: 20.9
ghostscript: 9.54.0
gmt: 6.2.0
GMT library information:
binary dir: C:/Users/matthewt/Anaconda3/envs/pygmt05
cores: 8
grid layout: rows
library path: C:/Users/matthewt/Anaconda3/envs/pygmt05/Library/bin/gmt.dll
padding: 2
plugin dir: C:/Users/matthewt/Anaconda3/envs/pygmt05/Library/bin/gmt_plugins
share dir: C:/Users/matthewt/Anaconda3/envs/pygmt05/Library/share/gmt
version: 6.2.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working