Skip to content

Remove conda-based build in favour of debian packages - #2

Merged
aethr merged 5 commits into
mainfrom
remove-conda
Aug 27, 2026
Merged

aethr merged 5 commits into
mainfrom
remove-conda

Conversation

@aethr

@aethr aethr commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • creates large docker images with many unused binaries and libs
  • binaries built against conda libs need those conda libs on every downstream docker image

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.

@aethr aethr self-assigned this Aug 14, 2026
aethr added 2 commits August 18, 2026 07:22
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.
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>
@prayner

prayner commented Aug 27, 2026

Copy link
Copy Markdown

scripts/build_wrf.sh: some scar tissue here with a couple of JASPER
exports. If we don't need them as options I suggest removing.

@aethr

aethr commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

scripts/build_wrf.sh: some scar tissue here with a couple of JASPER exports. If we don't need them as options I suggest removing.

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.

@aethr
aethr merged commit 22257f3 into main Aug 27, 2026
3 checks passed
@aethr
aethr deleted the remove-conda branch August 27, 2026 22:32
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.

Build jasper from source to restore GRIB2/JPEG2000 support

2 participants