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

OSError when using pygmt.grdimage with shading=True param #638

Closed
liwentao-319 opened this issue Oct 3, 2020 · 5 comments
Closed

OSError when using pygmt.grdimage with shading=True param #638

liwentao-319 opened this issue Oct 3, 2020 · 5 comments
Labels
bug Something isn't working upstream Bug or missing feature of upstream core GMT
Milestone

Comments

@liwentao-319
Copy link

liwentao-319 commented Oct 3, 2020

Description of the problem
Hi!

Yesterday I installed gmt6 and pygmt with conda on win10 system. It is very easy to use. I have ploted some figures with pygmt module. It is all fine until I add shading=True to pygmt.grdimage. Besides I can't pass the grid (xarray.DataArray) to call_module("grdgradient") using virtual_from_grid. The error is something about
"access violation reading", and I need some help to sovle this !!

code1 -> error1
image

image

code2->error2
image

System information

image

@welcome
Copy link

welcome bot commented Oct 3, 2020

👋 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.

@weiji14 weiji14 added the bug Something isn't working label Oct 3, 2020
@weiji14
Copy link
Member

weiji14 commented Oct 3, 2020

I have ploted some figures with pygmt module. It is all fine until I add shading=True to pygmt.grdimage.

你好 @liwentao-319, thanks for raising the issue and the kind words! What you are experiencing with grdimage shading may be a similar issue to #364. We tried to fix it in #581 but it appears to be an upstream issue with GMT 6.1.1, so it might take a while to fix (November 2020 probably), but it is definitely a priority for the next PyGMT v0.2.1 or v0.3.0 release.

In the meantime, if you really want grdimage with shading, either use pure GMT to do so, or try downgrading to GMT 6.1.0 and see if it works (though this comes with other issues).

Besides I can't pass the grid (xarray.DataArray) to call_module("grdgradient") using virtual_from_grid. The error is something about "access violation reading", and I need some help to sovle this !!

I've not seen this error before, might be a Windows thing, and I'll only have access to a Windows machine to check this. My guess is that you're on the 'E:' drive but it's trying to write to the 'C:' drive and this doesn't work. You could try without the GMTTempFile (just pass in a proper filepath) and see if it works, but do note that what you're using is a 'hack' and not something we support officially. If you have some time, you're welcome to submit a Pull Request to wrap grdgradient, I'm sure the community will greatly appreciate it 😄

Also, in the future, please post your error messages as text instead of as a screenshot, this will help users in the future to more easily search for the same issue!

@liwentao-319
Copy link
Author

OK, I will try it and post my codes and error messages as text next time. And thanks for your reply!

@seisman seisman added the upstream Bug or missing feature of upstream core GMT label Oct 8, 2020
@seisman
Copy link
Member

seisman commented Oct 15, 2020

@liwentao-319 As mentioned by @weiji14, this issue may be caused by an upstream GMT bug. In PR GenericMappingTools/gmt#4328, a related bug was fixed, and the PR may also fix the issue you're having. It would be good if you can try your scripts with the GMT development version.

As an Anaconda user, you can run conda install -c conda-forge/label/dev gmt to install the GMT development version. Please let us know if it solves your problems. Thanks.

@weiji14 weiji14 added this to the 0.2.1 milestone Oct 15, 2020
@liwentao-319
Copy link
Author

@seisman The command you advised works well. Thank you very much!!

@seisman seisman closed this as completed Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream Bug or missing feature of upstream core GMT
Projects
None yet
Development

No branches or pull requests

3 participants