Closed seisman closed 4 years ago
Sorry, got a bit caught up with a tricky PR in xarray
and some other stuff. Anyhow, these are what I'd personally like to finish for the release:
grid.gmt.registration
and grid.gmt.gtype
Nice to haves:
There are still tests failing due to baseline image changes as mentioned in #451. I don't think #476 will necessarily resolve the test failures, but if we can get #462 up and running, we can at least make sure things work ok for GMT 6.1.0.
Also been wondering if we should just use pytest.mark.xfail
to allow those grd*
tests to fail in GMT 6.0, but not on GMT 6.1.0 (dependent on getting #462). That way all the tests will be green and we can release confidently.
Ok, I've changed my mind. Since GMT 6.1.0 is out :tada:, let's just make a PyGMT release soon-ish and deal with those PRs (e.g. #500, #476, #480, #462) in v0.2.0.
I've got a workaround PR in #503 to temporarily expect the 13 failures we're seeing due to baseline image changes. Once that's merged in, I'll finalize the changelog at #504 and we should be able to cut a release soon after.
This is just to let you know that if you are planning a new release:
pygmt.grdimage is not working for me when using internal files with global projections (it used to work before, with the documented bugs). Everything, however, seems to work fine when passing netcdf filenames (which bypasses the pygmt virtual files). You can start by verifying the code in this issue:
https://github.com/GenericMappingTools/pygmt/issues/390
I have not debugged this too much, but I note that this is a problem for the projections Q and W, but not the hemispheric A.
pgmt: last commit on master gmt: 6.1.0
Hi @MarkWieczorek, thanks for the heads up. Can you clarify what you mean by 'not working'? I.e. is it a crash, or is there some other unexpected behaviour? Ideally we would test PyGMT v0.1.2 on both GMT 6.0 and 6.1, but I haven't got much time this week to do such extensive testing, but if it's quite critical, we could consider it.
Alternatively, it might be best to strongly recommend PyGMT v0.1.x users to stick with GMT 6.0, and reserve PyGMT v0.2.x for GMT 6.1 or above. The gridline/pixel registration and cartesian/geographic coordinate system issue we're trying to resolve in #476 is a very tricky beast, and will result in breaking changes for xarray
users in the interim no matter how careful we are. Sticking with netcdf filenames would be a smart thing to do for now.
Here is an example. The problem seems to be that pygmt can not project images when the central longitude is not 180 degrees. Changing the longitude to other values either gives incorrect output, or crashes.
import pygmt
# Creata a data array in gridline coordinates of sin(lon) * cos(lat)
interval = 10
lat = np.arange(90, -90-interval, -interval)
lon = np.arange(0, 360+interval, interval)
longrid, latgrid = np.meshgrid(lon, lat)
data = np.sin(np.deg2rad(longrid)) * np.cos(np.deg2rad(latgrid))
# create a DataArray
dataarray = xr.DataArray(data, coords=[('latitude', lat,
{'units': 'degrees_north'}),
('longitude', lon,
{'units': 'degrees_east'})],
attrs = {'actual_range': [-1, 1]})
dataset = dataarray.to_dataset(name='dataarray')
dataset.to_netcdf('test.grd')
This works
# create projected images using a cylindrical projection.
fig = pygmt.Figure()
fig.grdimage(dataset.dataarray, region='g', projection='Q180/0/6i', frame='a90f30g30')
fig.show(method='external')
This crashses
# create projected images using a cylindrical projection.
fig = pygmt.Figure()
fig.grdimage(dataset.dataarray, region='g', projection='Q0/0/6i', frame='a90f30g30')
fig.show(method='external')
with this error
grdimage [ERROR]: Passing zmax <= zmin prevents automatic CPT generation!
grdimage [ERROR]: Failed to read CPT (null).
Error: /syntaxerror in /--%ztokenexec_continue--
...
GMTCLibError: Module 'psconvert' failed with status code 78:
psconvert [ERROR]: System call [gs -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true '/Users/lunokhod/.gmt/sessions/gmt_session.47287/gmt_17.ps-' 2> '/Users/lunokhod/.gmt/sessions/gmt_session.47287/psconvert_47287c.bb'] returned error 256.
Using a longitude of 270 completes, but provides incorrect output.
A simple temporary fix to this problem would be to allow passing a netcdf object to pygmt, which would then open the netcdf object as a file (therefore bypassing the internal virtual file format:
Figure.grdimage(xarray_dataset.to_netcdf(), ...)
but unfortunately, this doesn't seem to work.
The to_netcdf() would just return None I think, you would need to pass the actual filename. And I suspect that GMT 6.1 probably breaks PyGMT v0.1.1 too?
I'm using GMT6.1.0: I am trying to figure out how to reinstall 6.0.0, but brew on macOS won't let me do this (see this issue).
I have tried using pygmt==0.1.1 and 0.1.0 with GMT6.1.0, but this doesn't fix anything. Thus, it is possible that this is a GMT6.1 issue, but it is hard for me to believe that a minor version update of GMT would break something as fundamental as this.
it is possible that this is a GMT6.1 issue, but it is hard for me to believe that a minor version update of GMT would break something as fundamental as this.
The GMT C API is complicated and it supports many different ways to pass data from external wrappers to GMT API. As I understand it, PyGMT is using a different way than GMT.jl and gmtmex. That's why PyGMT discovers so many bugs in the GMT C API, while GMT.jl and gmtmex work well.
GMT 6.1 actually made some big changes to how data are passed to GMT, although the API functions are unchanged. That's why it's tricky to support both GMT 6.0 and 6.1.
As for the issue you reported, it's not clear if it's a GMT bug or a PyGMT bug. I'd like to release 0.1.2 ASAP so that we can bump the minimum GMT version to 6.1.0 and see what's wrong with the code.
To be fair, I don't think we're introducing any new regressions with PyGMT v0.1.2, the same problem exists on PyGMT v0.1.1 in regard to GMT 6.1.0. I'm really sorry that things are broken, but this has been a messy situation (there are probably a dozen PRs that tried to handle GMT 6.0/6.1 compatibility but got stuck). What we might do is this:
@seisman, before I merge in #504, do you think we should update the install instructions at https://github.com/GenericMappingTools/pygmt/blob/master/doc/install.rst#installing-gmt-and-other-dependencies to say conda create --name pygmt gmt=6.0
instead of just gmt
? Or would the hard pin on conda-forge be better?
- Release PyGMT v0.1.1, and do a hard pin on GMT 6.0 on conda-forge so users don't install GMT 6.1 accidentally (or at least document it in the install instructions?).
Perhaps not pin on GMT 6.0. With PyGMT v0.1.2 + GMT 6.1.0,
Considering the three points above, allowing the combination of PyGMT v0.1.2 + GMT 6.1.0 is a better choice.
Ok, so no hard pin. And I won't bother with the install instruction update then since things should work for most cases, we'll fix #390 and others in v0.2.0. Will merge in #504 now (and go have lunch).
Yes, good to me (and go have dinner).
Ok, I've pushed the v0.1.2 tag, and will make a release shortly. I'll also handle the Zenodo archive this time since I reserved the DOI, but I should let you have a go for v0.2.0.
Alright, conda-forge packages are up on https://anaconda.org/conda-forge/pygmt/files, and I've made the announcement on https://forum.generic-mapping-tools.org/t/pygmt-v0-1-2-released/629. Feel free to close this, and we can start to work on v0.2.0 :tada:
I also updated the project progress on ResearchGate (https://www.researchgate.net/project/PyGMT-A-Python-interface-for-the-Generic-Mapping-Tools).
Done with the v0.1.2 release. Closed.
Cool, thanks for that! I really need to get on that ResearchGate project, and we should add Liam as well. Do we need @leouieda to do it?
I think I can edit the collaborators and add your names, but it seems the names are not linked to your accounts.
Seems like we need to follow each other to be collaborators (see https://www.researchgate.net/post/how_can_I_add_collaborators_to_an_existing_project). Could you try that and see if it works?
It works. I added you but can't change the order of the names.
All good, I changed the order (just had to delete Paul's name first and add it back at the end).
Release: v0.1.2 Scheduled Date: 2020/07/01
Before release:
Release:
After release:
3rd party update: