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-hdf5 dependency #293

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Conversation

seisman
Copy link
Contributor

@seisman seisman commented Jul 20, 2024

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.

@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/meta.yaml) and found it was in an excellent condition.

@seisman seisman marked this pull request as ready for review July 20, 2024 07:53
@seisman seisman requested review from leouieda and ocefpaf as code owners July 20, 2024 07:53
recipe/meta.yaml Outdated
Comment on lines 45 to 46
- libgdal-jp2openjpeg
- libgdal-hdf5
Copy link
Member

Choose a reason for hiding this comment

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

Sort h-i-j. Can you also add a test for reading a NetCDF/HDF5 file?

Suggested change
- libgdal-jp2openjpeg
- libgdal-hdf5
- libgdal-hdf5
- libgdal-jp2openjpeg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you also add a test for reading a NetCDF/HDF5 file?

I added a test in ff8d995, and it worked without the libgdal-hdf5 library, but if I add libgdal-hdf5 in GenericMappingTools/pygmt@bb0efe3, tests passed (except one failure which is not directly related to the issue).

I think the reason is, when reading a netCDF file, GMT calls the netcdf library, but in GenericMappingTools/pygmt#3338, we're actually trying to read a netCDF file as an image (into a GMT_IMAGE container), which instead calls GDAL to read the file.

Copy link
Member

@weiji14 weiji14 Jul 20, 2024

Choose a reason for hiding this comment

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

Right... so should we actually add libgdal-hdf5 as a dependency here then? To be honest, that test_clib_read_data_image_actual_grid test in GenericMappingTools/pygmt#3338 is a bit weird since we're trying to read a 1-band grid as a GMT image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, that test_clib_read_data_image_actual_grid test in GenericMappingTools/pygmt#3338 is a bit weird since we're trying to read a 1-band grid as a GMT image.

The original idea comes from GenericMappingTools/pygmt#3318 (comment) to solve the issue GenericMappingTools/pygmt#3115 (comment).

For any given file, we can call Session.read_data to read the file header only and determine the raster kind (grid, image or cube). It turns out, we can read ".nc" file as a GMT image and read ".tif" file as a GMT grid. So that test was added to understand what's exactly happening.

so should we actually add libgdal-hdf5 as a dependency here then?

We still need libgdal-hdf5, because reading other image formats via GDAL will likely need the HDF5 library.

Copy link
Member

Choose a reason for hiding this comment

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

Or actually, can you add the test back and use the =gd modifier to force GMT to read the NetCDF file using GDAL? https://docs.generic-mapping-tools.org/6.5/reference/features.html#modifiers-to-read-and-write-grids-and-images-via-gdal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gmt grdcut @earth_relief_01d=gd -R-10/-9/3/5 -Greliefcut.nc

Test fails without libgdal-hdf5. See
https://github.com/conda-forge/gmt-feedstock/pull/293/checks?check_run_id=27695109707

Copy link
Member

Choose a reason for hiding this comment

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

Awesome, I'll apply this to the dev branch for the next dev version update next week or so.

recipe/meta.yaml Outdated Show resolved Hide resolved
recipe/meta.yaml Outdated Show resolved Hide resolved
@seisman seisman marked this pull request as draft July 21, 2024 00:53
@@ -64,6 +65,9 @@ test:
- gmt-config --all # [not win]
- gmt # [win]
- gmt grdmath -Rg -I1 0 90 SDIST = dist_to_NP.nc -x2
# Test reading/writing a netCDF/HDF5 file
- gmt grdcut @earth_relief_01d=gd:netCDF -R5/10/3/5 -Greliefcut.nc
Copy link
Member

Choose a reason for hiding this comment

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

Won't this use the libgdal-netcdf driver instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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