Skip to content

Check if structure exist before accessing its members #3512

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

Merged
merged 1 commit into from
Jun 21, 2020
Merged

Conversation

PaulWessel
Copy link
Member

Hopefully fixes #3510. Let me know @seisman.

@PaulWessel PaulWessel requested a review from seisman June 21, 2020 04:39
@seisman
Copy link
Member

seisman commented Jun 21, 2020

This PR works well for PyGMT, but now there are two new failing tests:

	205 - anim04/anim04.sh (Failed)
	249 - genper/east_map_8.sh (Failed)

These two tests also fail on the master branch but they're not related to grdimage:

grdblend [WARNING]: File @N30W120.earth_relief_02m_p.nc coordinates are phase-shifted w.r.t. the output grid - must resample
grdsample [ERROR]: Option -R parsing failure. Correct syntax:
	-R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>]
	  Append +r if giving lower left and upper right coordinates
	-Rg or -Rd for global domain
	-R<grdfile> to take the domain from a grid file
grdsample [ERROR]: Offending option -R275.016666667/290.016666667/30.0166666667/-143165531.517
grdblend [ERROR]: Unable to resample file @N30W120.earth_relief_02m_p.nc - exiting
grdcut [ERROR]: ERROR - Unable to produce blended grid from /var/folders/mz/d3wtwjtx4fg8qlds5lgt1c240000gn/T/=tiled_56_GX.G88AFt
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
grdimage [ERROR]: Cannot find file etopo2-chesapeake.nc

@PaulWessel
Copy link
Member Author

Will check once done with another branch (... the cpt solution).

@seisman seisman merged commit e5b54a4 into master Jun 21, 2020
@seisman seisman deleted the safer-check branch June 21, 2020 05:22
@PaulWessel
Copy link
Member Author

Did your problem go away? I am just getting the two gdal_nn.sh and grdimage_img_tif.sh failures for master.

@seisman
Copy link
Member

seisman commented Jun 21, 2020

They're still failing for master.

@seisman
Copy link
Member

seisman commented Jun 21, 2020

After running the two failing tests, I have these two files in earth/earth_relief/earth_relief_02m_p:

  1. N30W120.earth_relief_02m_p.jp2
  2. S30W120.earth_relief_02m_p.jp2

@seisman
Copy link
Member

seisman commented Jun 21, 2020

Perhaps something wrong with my GDAL.

I download a tile directly from the GMT server:

wget --no-check-certificate https://oceania.generic-mapping-tools.org/server/earth/earth_relief/earth_relief_02m_p/N30E000.earth_relief_02m_p.jp2

The md5sum of the tile is the same as the one in the GMT server:

271290bad03ccd1679fdcd9232fbc05d  N30E000.earth_relief_02m_p.jp2

But gdalinfo doesn't recognize the tile:

gdalinfo N30E000.earth_relief_02m_p.jp2
ERROR 4: `N30E000.earth_relief_02m_p.jp2' not recognized as a supported file format.
gdalinfo failed - unable to open 'N30E000.earth_relief_02m_p.jp2'.

@seisman
Copy link
Member

seisman commented Jun 21, 2020

I mistakenly used the gdalinfo from macports (without openjpeg support). Now all tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants