diff --git a/.ci/docker/Dockerfile_disp_s1 b/.ci/docker/Dockerfile_disp_s1 index 7fde6386..492c78db 100644 --- a/.ci/docker/Dockerfile_disp_s1 +++ b/.ci/docker/Dockerfile_disp_s1 @@ -52,12 +52,15 @@ RUN set -ex \ && chmod +x ${CONDA_ROOT}/bin/*_entrypoint.sh \ && source /usr/local/bin/_activate_current_env.sh \ && ${MAMBA_EXE} install --yes --channel conda-forge --file ${PGE_DEST_DIR}/opera/requirements.txt \ - && ${MAMBA_EXE} install --yes --channel conda-forge eccodes jpeg \ && chmod 775 ${PGE_DEST_DIR} \ + # Create a separate conda environment for the eccodes install needed to run grib_to_netcdf + && ${MAMBA_EXE} create -n eccodes \ + && ${MAMBA_EXE} install -n eccodes --yes --channel conda-forge eccodes jpeg \ + # Install grib_to_netcdf and make it available to the eccodes conda env && curl -o /tmp/eccodes-2.28.1-1.x86_64.rpm https://artifactory-fn.jpl.nasa.gov:443/artifactory/general/gov/nasa/jpl/opera/sds/pge/disp_s1/eccodes/eccodes-2.28.1-1.x86_64.rpm \ && dnf install -y /tmp/eccodes-2.28.1-1.x86_64.rpm \ && rm -rf /tmp/eccodes-2.28.1-1.x86_64.rpm \ - && ln -sf /opt/eccodes/bin/grib_to_netcdf /opt/conda/bin/ + && ln -sf /opt/eccodes/bin/grib_to_netcdf /opt/conda/envs/eccodes/bin/ # Set the Docker entrypoint and clear the default command ENTRYPOINT ["sh", "-c", "source /usr/local/bin/_activate_current_env.sh;exec ${CONDA_ROOT}/bin/pge_docker_entrypoint.sh \"${@}\"", "--"] diff --git a/src/opera/pge/disp_s1/disp_s1_pge.py b/src/opera/pge/disp_s1/disp_s1_pge.py index 59000638..be59f2d8 100644 --- a/src/opera/pge/disp_s1/disp_s1_pge.py +++ b/src/opera/pge/disp_s1/disp_s1_pge.py @@ -93,13 +93,14 @@ def convert_troposphere_model_files(self): grib_file_name = tropo_file subprocess.run( [ - "grib_to_netcdf", + "/opt/conda/envs/eccodes/bin/grib_to_netcdf", "-D", "NC_FLOAT", "-o", netcdf_file, grib_file_name[:-4], ], + env={'ENV_NAME': 'eccodes', 'LD_LIBRARY_PATH': '/opt/conda/envs/eccodes/lib'}, shell=False, check=False, ) diff --git a/src/opera/test/pge/disp_s1/test_disp_s1_pge.py b/src/opera/test/pge/disp_s1/test_disp_s1_pge.py index 260bb505..fc02df71 100644 --- a/src/opera/test/pge/disp_s1/test_disp_s1_pge.py +++ b/src/opera/test/pge/disp_s1/test_disp_s1_pge.py @@ -41,7 +41,7 @@ def mock_grib_to_netcdf(*popenargs, input=None, capture_output=False, timeout=No here we do not want this mocked version to run. """ - if popenargs[0][0] == "grib_to_netcdf": + if popenargs[0][0].endswith("grib_to_netcdf"): output_path = popenargs[0][4] open(output_path, 'w').close() else: