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

Add libgdal-jp2openjpeg dependency #291

Merged
merged 7 commits into from
Jul 15, 2024

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented Jul 15, 2024

Enable reading tiled .jp2 files from https://docs.generic-mapping-tools.org/latest/datasets/remote-data.html such as earth_relief, mars_relief, earth_age, mercury_relief, earth_faa, moon_relief, earth_geoid, pluto_relief, earth_mag, venus_relief, earth_mag4km, earth_wdmam, earth_synbath, earth_vgg.

The gdal package on conda-forge now depends on libgdal-core which is a lightweight version that doesn't include certain drivers. See conda-forge/gdal-feedstock#948 and conda-forge/gdal-feedstock#722.

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

Closes GenericMappingTools/pygmt#3328

To test for existence of libgdal-jp2openjpeg driver.
@conda-forge-webservices
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

recipe/meta.yaml Outdated
Comment on lines 66 to 67
# Test reading/writing a JP2 file (S90E000.earth_relief_05m_p.jp2)
- gmt grdcut @earth_relief_05m -R-10/-9/3/5 -G/tmp/reliefcut.jp2=gd:JP2OpenJPEG
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this doesn't error with a non-zero exit code at https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=978661&view=logs&j=656edd35-690f-5c53-9ba3-09c10d0bea97&t=986b1512-c876-5f92-0d81-ba851554a0a3&l=4457:

+ gmt grdcut @earth_relief_05m -R-10/-9/3/5 -G/tmp/reliefcut.jp2=gd:JP2OpenJPEG
grdblend [NOTICE]: Remote data courtesy of GMT data server oceania [http://oceania.generic-mapping-tools.org/]

grdblend [NOTICE]: SRTM15 Earth Relief v2.6 at 05x05 arc minutes reduced by Gaussian Cartesian filtering (26.2 km fullwidth) [Tozer et al., 2019].
grdblend [NOTICE]:   -> Download 180x180 degree grid tile (earth_relief_05m_g): S90W180
ERROR 4: `/home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2' not recognized as being in a supported file format. It could have been recognized by driver JP2OpenJPEG, but plugin gdal_JP2OpenJPEG.so is not available in your installation. You may install it with 'conda install -c conda-forge libgdal-jp2openjpeg'
grdblend [ERROR]: ERROR - Unable to convert SRTM file /home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2 to compressed netCDF format
grdblend [ERROR]: Unable to obtain remote file @S90W180.earth_relief_05m_g.nc
ERROR 4: `/home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2' not recognized as being in a supported file format. It could have been recognized by driver JP2OpenJPEG, but plugin gdal_JP2OpenJPEG.so is not available in your installation. You may install it with 'conda install -c conda-forge libgdal-jp2openjpeg'
grdblend [ERROR]: ERROR - Unable to convert SRTM file /home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2 to compressed netCDF format
grdblend [ERROR]: Cannot find file @S90W180.earth_relief_05m_g.nc
ERROR 4: `/home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2' not recognized as being in a supported file format. It could have been recognized by driver JP2OpenJPEG, but plugin gdal_JP2OpenJPEG.so is not available in your installation. You may install it with 'conda install -c conda-forge libgdal-jp2openjpeg'
grdblend [ERROR]: ERROR - Unable to convert SRTM file /home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2 to compressed netCDF format
grdblend [ERROR]: Cannot find file @S90W180.earth_relief_05m_g.nc
grdblend [ERROR]: File @S90W180.earth_relief_05m_g.nc not found
[Session gmt (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16)
grdcut [ERROR]: ERROR - Unable to produce blended grid from /tmp/=tiled_333_GX_YV6NSp
[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)
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
+ exit 0

@seisman, is there a better to do this JP2 driver check?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just run gdal-config --formats | grep JP2OpenJPEG?

Copy link
Member Author

@weiji14 weiji14 Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That won't error with a non-zero exit code (and JP2OpenJPEG seems to be listed even though libgdal-jp2openjpeg isn't installed).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gmt grdcut @earth_relief_05m -R-10/-9/3/5 -G/tmp/reliefcut.jp2=gd:JP2OpenJPEG

Maybe check if /tmp/reliefcut.jp2 exists?

Copy link
Member Author

@weiji14 weiji14 Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this seems to work:

gmt grdcut @earth_relief_05m -R-10/-9/3/5 -G/tmp/reliefcut.jp2=gd:JP2OpenJPEG
[ -e '/tmp/reliefcut.jp2' ] && exit 0 || exit 1

errors as intended at https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=978819&view=logs&j=656edd35-690f-5c53-9ba3-09c10d0bea97&t=986b1512-c876-5f92-0d81-ba851554a0a3&l=4480:

+ gmt grdcut @earth_relief_05m -R-10/-9/3/5 -G/tmp/reliefcut.jp2=gd:JP2OpenJPEG
grdblend [NOTICE]: Remote data courtesy of GMT data server oceania [http://oceania.generic-mapping-tools.org/]

grdblend [NOTICE]: SRTM15 Earth Relief v2.6 at 05x05 arc minutes reduced by Gaussian Cartesian filtering (26.2 km fullwidth) [Tozer et al., 2019].
grdblend [NOTICE]:   -> Download 180x180 degree grid tile (earth_relief_05m_g): S90W180
ERROR 4: `/home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2' not recognized as being in a supported file format. It could have been recognized by driver JP2OpenJPEG, but plugin gdal_JP2OpenJPEG.so is not available in your installation. You may install it with 'conda install -c conda-forge libgdal-jp2openjpeg'
grdblend [ERROR]: ERROR - Unable to convert SRTM file /home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2 to compressed netCDF format
grdblend [ERROR]: Unable to obtain remote file @S90W180.earth_relief_05m_g.nc
ERROR 4: `/home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2' not recognized as being in a supported file format. It could have been recognized by driver JP2OpenJPEG, but plugin gdal_JP2OpenJPEG.so is not available in your installation. You may install it with 'conda install -c conda-forge libgdal-jp2openjpeg'
grdblend [ERROR]: ERROR - Unable to convert SRTM file /home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2 to compressed netCDF format
grdblend [ERROR]: Cannot find file @S90W180.earth_relief_05m_g.nc
ERROR 4: `/home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2' not recognized as being in a supported file format. It could have been recognized by driver JP2OpenJPEG, but plugin gdal_JP2OpenJPEG.so is not available in your installation. You may install it with 'conda install -c conda-forge libgdal-jp2openjpeg'
grdblend [ERROR]: ERROR - Unable to convert SRTM file /home/conda/.gmt/server/earth/earth_relief/earth_relief_05m_g/S90W180.earth_relief_05m_g.jp2 to compressed netCDF format
grdblend [ERROR]: Cannot find file @S90W180.earth_relief_05m_g.nc
grdblend [ERROR]: File @S90W180.earth_relief_05m_g.nc not found
[Session gmt (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16)
grdcut [ERROR]: ERROR - Unable to produce blended grid from /tmp/=tiled_333_GX_TH7dZO
[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)
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
+ '[' -e /tmp/reliefcut.jp2 ']'
+ exit 1

Gonna wait to see if this works on Windows though 🙂 Edit: yeah, the test fails on Windows as expected, but on the grdcut command rather than the [ -e '/tmp/reliefcut.jp2'] command...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test fails on Windows as expected, but on the grdcut command rather than the [ -e '/tmp/reliefcut.jp2'] command...

Maybe the /tmp directory doesn't exist on Windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, maybe just write to the current directory. Feel free to push to this branch, it's late for me already so won't get to it until tomorrow.

@conda-forge-webservices
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipe) and found some lint.

Here's what I've got...

For recipe:

  • Failed to even lint the recipe, probably because of a conda-smithy bug 😢. This likely indicates a problem in your meta.yaml, though. To get a traceback to help figure out what's going on, install conda-smithy and run conda smithy recipe-lint . from the recipe directory.

Square brackets might be mistaken for selectors.
@conda-forge-webservices
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

@weiji14
Copy link
Member Author

weiji14 commented Jul 15, 2024

@conda-forge-admin, please rerender

Copy link
Contributor

Hi! This is the friendly automated conda-forge-webservice.

I tried to rerender for you, but it looks like there was nothing to do.

This message was generated by GitHub actions workflow run https://github.com/conda-forge/gmt-feedstock/actions/runs/9936852688.

recipe/meta.yaml Outdated Show resolved Hide resolved
recipe/meta.yaml Outdated Show resolved Hide resolved
@seisman seisman marked this pull request as ready for review July 15, 2024 12:38
@seisman seisman merged commit 058b79f into conda-forge:main Jul 15, 2024
7 checks passed
@seisman
Copy link
Contributor

seisman commented Jul 15, 2024

Tests pass and the PR is merged. Please also apply the same fix to the dev branch when you have time.

@weiji14 weiji14 deleted the libgdal-jp2openjpeg branch July 15, 2024 19:34
weiji14 added a commit to GenericMappingTools/gmt-feedstock that referenced this pull request Jul 16, 2024
@weiji14
Copy link
Member Author

weiji14 commented Jul 16, 2024

Tests pass and the PR is merged. Please also apply the same fix to the dev branch when you have time.

Included as part of #292

seisman pushed a commit that referenced this pull request Jul 16, 2024
* Bump GMT dev version from 6.6.0.dev0+eec0fc5 to 6.6.0.dev1+708d76b

* Fix incorrect edits from yq

Need to update bumpdevversion.yml script later.

* Add libgdal-jp2openjpeg as runtime dependency

Cherry-picked from 058b79f/#291

* Actually add libgdal-jp2openjpeg as a runtime dependency

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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