Skip to content

Commit

Permalink
Updated build process for DISP-S1 PGE to isoloate grib_to_netcdf depe…
Browse files Browse the repository at this point in the history
…ndencies in their own conda environment
  • Loading branch information
Scott Collins committed Jan 16, 2024
1 parent 4907bbf commit cf66eeb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .ci/docker/Dockerfile_disp_s1
Original file line number Diff line number Diff line change
Expand Up @@ -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 \"${@}\"", "--"]
Expand Down
3 changes: 2 additions & 1 deletion src/opera/pge/disp_s1/disp_s1_pge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion src/opera/test/pge/disp_s1/test_disp_s1_pge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit cf66eeb

Please sign in to comment.