Repository navigation
Remove conda-based build in favour of debian packages - #2
Merged
Merged
Conversation
Jasper is no longer available in debian repos due to unresolved CVEs, but is a hard build dependency for WRF/WPS GRIB support (grib.exe). This adds a Docker build stage just for Jasper and copies it into the builder image before compiling WRF/WPS. Resolves #1.
1 of 3 tasks
WPS 4.2-4.6 passes an uninitialised local, is_subgrid_var, to metgrid's get_next_output_fieldname, which declares it intent(in) and never assigns it, then reads it back to decide whether to keep each output field. The conda build's gfortran 10.4 happened to leave that stack slot zero; trixie's gfortran 14 does not, so every field is discarded: NUM_FIELDS ends up 0, metgrid never calls ext_ncd_write_field, and it reports "Successful completion" while writing met_em files holding nothing but Times and the global attributes. real.exe then dies on the missing num_metgrid_levels dimension. No compiler setting differed between the two environments - WPS takes its Fortran flags from arch/configure.defaults and ignores $FCFLAGS, so both builds used identical flags. Only the compiler version changed, and the old build was always relying on luck. -finit-logical=false makes that behaviour explicit. It is deliberately narrower than -finit-local-zero: is_subgrid_var is the only unassigned local involved (sr_x/sr_y are set by get_subgrid_dim_name), so this avoids zero-filling large automatic arrays throughout WPS. Patching the flag rather than the source keeps the fix independent of WPS_VERSION, and the grep guard fails the build if it ever stops applying instead of silently shipping a metgrid.exe that writes nothing. Fixed upstream in WPS 4.7.0 by commit 4063e190; this can be dropped once WPS_VERSION reaches it. Verified against the failed run's own inputs (ungrib.exe + metgrid.exe on the 2022-12-07 au-test gribs): all seven met_em files go from 15,457 bytes to within a few bytes of the conda-era reference, with 89 variables, num_metgrid_levels = 34, num_st_layers = 4, and TT spanning 195.4-307.4 K. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
scripts/build_wrf.sh: some scar tissue here with a couple of JASPER |
prayner
approved these changes
Aug 27, 2026
Contributor
Author
Most of the time I agree with removing scar tissue. The reason I left these in place was because the options available in the build scripts aren't documented anywhere, this seemed like useful context even if unused. However, since most of the build options seem to barely work anyway and Claude is quite good at figuring out what's required, I'm fine with removing them. Removed in 8ff572c. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
This removes conda, which was used to source lib dependencies like HDF5, NetCDF, etc, in favour of a plain debian trixie environment using packages from the debian repositories. Although conda provides ease of use when running local development environments, there are some downsides with the way we're using it:
In particular, having to provide the docker-wrf conda environment in the setup-wrf container has caused issues when setup-wrf needed an additional package to be installed. This created an unresolvable dependency version issue which isn't a problem using plain debian packages.
jasper JPEG2000 lib
The jasper lib is used by WRF to provide JPEG2000 compression support within GRIB files. Although the Open Methane project doesn't use any GRIB files with JPEG2000 compression, the WPS build scripts aren't well parameterised, and require jasper to be present to build with any GRIB support at all.
Debian package repos don't provide any version of jasper, so a stage has been added to the Dockerfile to build jasper from source (issue #1) ahead of building WRF/WPS.