-
Notifications
You must be signed in to change notification settings - Fork 224
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
Fix UnicodeDecodeError with shapefiles for plot and plot3d #1695
Conversation
Do I need to add a test for #1616? If yes, is there a shapefile that I can use? |
I think it would be good to have either a test or a gallery example. One option would be to use the same data as the roads gallery example with gdf.to_file. Another option would be to convert RidgeTest.gmt to a shapefile (possibly we could cache the shapefile to speed up the new PyGMT test and https://github.com/GenericMappingTools/gmt/blob/master/test/psxy/categorical.sh):
|
Sounds a good idea. |
Unfortunately it won't work, because the |
You could do |
There's also some sample shapefile data at https://github.com/intake/intake_geopandas/tree/0.4.0/tests/data/stations you can just download and use. |
Could the .shp file be added to pygmt/tests/data as a workaround to have a cached file? |
Summary of changed imagesThis is an auto-generated report of images that have changed on the DVC remote
Image diff(s)Report last updated at commit 3712edc |
pygmt/tests/data/RidgeTest.prj
Outdated
@@ -0,0 +1 @@ | |||
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not sure if storing the shapefile (shp/shx/dbf/prj) in the git history is a good idea. I'm thinking whether we should put it on dvc
, or maybe add some custom code to pygmt.helpers.testing.download_test_data()
to download the shapefile using urllib
or plain pygmt.which
.
from pygmt import which
for ext in ["shp", "shx", "dbf", "prj"]:
which(
fname=f"https://github.com/intake/intake_geopandas/raw/0.4.0/tests/data/stations/stations.{ext}",
download=True,
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option would be to convert RidgeTest.gmt to a shapefile (possibly we could cache the shapefile to speed up the new PyGMT test and https://github.com/GenericMappingTools/gmt/blob/master/test/psxy/categorical.sh):
test_data=`gmt which -Gl @RidgeTest.gmt` ogr2ogr -f "ESRI Shapefile" RidgeTest.shp $test_data
I'm considering the option from @meghanrjones again. I think it makes more sense to cache the shapefile in the GMT server, because they can also be used by GMT and GMT.jl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a PR in GenericMappingTools/gmtserver-admin#142.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @seisman! Looks nice and clean now.
/format |
It seems the new test crashes. |
I do not see the new RidgeTest.shp files in the data downloaded from the cache. You may need to rerun the cache data workflow. |
You're right, there is a scheduled run of the cache data workflow yesterday. |
Description of proposed changes
Fixes #1616
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version