已合并
[New Image] Add nco 5.4.0-alpha04 for openEuler 24.03-lts-sp4 #3270
jcccx创建于 9 天前
[New Image] Add nco 5.4.0-alpha04 for openEuler 24.03-lts-sp4 #3270
已合并
共 10 个文件变更+307-0
| @@ -82,3 +82,4 @@ images: | |||
| 82 | ncl: ncl | 82 | ncl: ncl |
| 83 | code_aster: code_aster | 83 | code_aster: code_aster |
| 84 | ncview: ncview | 84 | ncview: ncview |
| 85 | + nco: nco | ||
| @@ -0,0 +1,42 @@ | |||
| 1 | +ARG BASE=openeuler/openeuler:24.03-lts-sp4 | ||
| 2 | +FROM ${BASE} AS builder | ||
| 3 | + | ||
| 4 | +ARG VERSION=5.4.0-alpha04 | ||
| 5 | + | ||
| 6 | +RUN dnf install -y \ | ||
| 7 | + gcc gcc-c++ make \ | ||
| 8 | + flex bison \ | ||
| 9 | + netcdf-devel hdf5-devel \ | ||
| 10 | + antlr-C++ antlr-tool gsl-devel \ | ||
| 11 | + curl-devel libxml2-devel expat-devel zlib-devel && \ | ||
| 12 | + dnf clean all | ||
| 13 | + | ||
| 14 | +RUN curl -fSL --connect-timeout 30 --retry 2 \ | ||
| 15 | + -o /tmp/nco.tar.gz \ | ||
| 16 | + https://github.com/nco/nco/archive/refs/tags/${VERSION}.tar.gz && \ | ||
| 17 | + mkdir -p /tmp/nco-src && \ | ||
| 18 | + tar xzf /tmp/nco.tar.gz -C /tmp/nco-src --strip-components=1 && \ | ||
| 19 | + cd /tmp/nco-src && \ | ||
| 20 | + ./configure --prefix=/usr/local --disable-udunits && \ | ||
| 21 | + make -j$(nproc) && \ | ||
| 22 | + make install && \ | ||
| 23 | + cd / && \ | ||
| 24 | + rm -rf /tmp/nco.tar.gz /tmp/nco-src | ||
| 25 | + | ||
| 26 | +FROM ${BASE} | ||
| 27 | + | ||
| 28 | +RUN dnf install -y \ | ||
| 29 | + netcdf hdf5 \ | ||
| 30 | + gsl antlr-C++ \ | ||
| 31 | + libcurl libxml2 expat zlib \ | ||
| 32 | + perl && \ | ||
| 33 | + dnf clean all | ||
| 34 | + | ||
| 35 | +COPY --from=builder /usr/local /usr/local | ||
| 36 | + | ||
| 37 | +RUN printf '/usr/local/lib\n/usr/local/lib64\n' > /etc/ld.so.conf.d/nco.conf && \ | ||
| 38 | + ldconfig | ||
| 39 | + | ||
| 40 | +ENV PATH=/usr/local/bin:$PATH | ||
| 41 | +USER root | ||
| 42 | +WORKDIR /data | ||
| @@ -0,0 +1,43 @@ | |||
| 1 | +# Quick reference | ||
| 2 | + | ||
| 3 | +- The official NCO docker image. | ||
| 4 | + | ||
| 5 | +- Maintained by: [openEuler CloudNative SIG](https://gitcode.com/openeuler/cloudnative). | ||
| 6 | + | ||
| 7 | +- Where to get help: [openEuler CloudNative SIG](https://gitcode.com/openeuler/cloudnative), [openEuler](https://gitcode.com/openeuler/community). | ||
| 8 | + | ||
| 9 | +# NCO | openEuler | ||
| 10 | +The netCDF Operators (NCO) comprise about a dozen standalone, command-line programs that take [netCDF](http://www.unidata.ucar.edu/netcdf), [HDF](http://hdfgroup.org), and/or [DAP](http://opendap.org) files as input, then operate (e.g., derive new fields, compute statistics, print, hyperslab, manipulate metadata, regrid) and output the results to screen or files in text, binary, or netCDF formats. NCO aids analysis of gridded and unstructured scientific data. The shell-command style of NCO allows users to manipulate and analyze files interactively, or with expressive scripts that avoid some overhead of higher-level programming environments. | ||
| 11 | +Learn more at [NCO Homepage](http://nco.sf.net). | ||
| 12 | + | ||
| 13 | +# Supported tags and respective Dockerfile links | ||
| 14 | +The tag of each NCO docker image is consist of the version of NCO and the version of basic image. The details are as follows: | ||
| 15 | +| Tags | Currently | Architectures | | ||
| 16 | +|------|-----------|---------------| | ||
| 17 | +|[5.4.0-alpha04-oe2403sp4](https://gitcode.com/openeuler/openeuler-docker-images/blob/master/HPC/nco/5.4.0-alpha04/24.03-lts-sp4/Dockerfile) | NCO 5.4.0-alpha04 on openEuler 24.03-lts-sp4 | amd64, arm64 | | ||
| 18 | + | ||
| 19 | +# Usage | ||
| 20 | +- Ensure that you have Docker installed, or are using Docker for Linux containers if on Windows. | ||
| 21 | +- Pull the NCO docker image from DockerHub: | ||
| 22 | +``` | ||
| 23 | + docker pull openeuler/nco:{Tag} | ||
| 24 | +``` | ||
| 25 | +- Print the metadata of a netCDF file, e.g., `in.nc`, located in the current working directory: | ||
| 26 | +``` | ||
| 27 | + docker run --rm -v $(pwd):/data openeuler/nco:{Tag} ncks -m in.nc | ||
| 28 | +``` | ||
| 29 | +- Copy the variable `lat` from `in.nc` to `out.nc`: | ||
| 30 | +``` | ||
| 31 | + docker run --rm -v $(pwd):/data openeuler/nco:{Tag} ncks -v lat -O in.nc out.nc | ||
| 32 | +``` | ||
| 33 | +- NCO operators are command-line programs that exit after the operation completes, so the container stops as soon as the operator finishes; results are printed to the terminal or written to output files rather than to container logs. | ||
| 34 | +``` | ||
| 35 | + docker run --rm -v $(pwd):/data openeuler/nco:{Tag} ncra -O in.nc avg.nc | ||
| 36 | +``` | ||
| 37 | +- To run multiple NCO operators interactively, start a shell inside the container and execute the operators one by one: | ||
| 38 | +``` | ||
| 39 | + docker run -it --rm -v $(pwd):/data openeuler/nco:{Tag} /bin/bash | ||
| 40 | +``` | ||
| 41 | + | ||
| 42 | +# Question and answering | ||
| 43 | +If you have any questions or want to use some special features, please submit an issue or a pull request on [openeuler-docker-images](https://gitcode.com/openeuler/openeuler-docker-images). | ||
| @@ -0,0 +1,60 @@ | |||
| 1 | +name: nco | ||
| 2 | +category: hpc | ||
| 3 | +description: NCO(netCDF Operators,netCDF 操作工具)是一组独立的命令行程序,以 netCDF、HDF 和/或 DAP 文件为输入,进行派生新数据、统计计算、打印、子区域提取、元数据操作和重网格化等操作,并将结果输出到屏幕或文件中。NCO 利用 CF(Climate & Forecast)元数据约定、UDUnits 物理维度转换、OPeNDAP 网络透明访问、HDF 存储特性以及 GSL 科学计算库的多种数学与统计算法,支持网格化与非结构化的科学数据分析。 | ||
| 4 | +environment: | | ||
| 5 | + 本应用在Docker环境中运行,安装Docker执行如下命令 | ||
| 6 | + ``` | ||
| 7 | + yum install -y docker | ||
| 8 | + ``` | ||
| 9 | +tags: | | ||
| 10 | + nco镜像的Tag由其版本信息和基础镜像版本信息组成,详细内容如下 | ||
| 11 | + | ||
| 12 | + | Tag | Currently | Architectures | | ||
| 13 | + |----------|-------------|------------------| | ||
| 14 | + |[5.4.0-alpha04-oe2403sp4](https://gitcode.com/openeuler/openeuler-docker-images/blob/master/HPC/nco/5.4.0-alpha04/24.03-lts-sp4/Dockerfile) | nco 5.4.0-alpha04 on openEuler 24.03-lts-sp4 | amd64, arm64 | | ||
| 15 | + | ||
| 16 | +download: | | ||
| 17 | + 拉取镜像到本地 | ||
| 18 | + ``` | ||
| 19 | + docker pull openeuler/nco:{Tag} | ||
| 20 | + ``` | ||
| 21 | + | ||
| 22 | +usage: | | ||
| 23 | + - 打印当前工作目录下 netCDF 文件 in.nc 的元数据: | ||
| 24 | + ``` | ||
| 25 | + docker run --rm -v $(pwd):/data openeuler/nco:{Tag} ncks -m in.nc | ||
| 26 | + ``` | ||
| 27 | + | ||
| 28 | + - 将变量 lat 从 in.nc 复制到 out.nc: | ||
| 29 | + ``` | ||
| 30 | + docker run --rm -v $(pwd):/data openeuler/nco:{Tag} ncks -v lat -O in.nc out.nc | ||
| 31 | + ``` | ||
| 32 | + | ||
| 33 | + - 对多个记录文件求平均: | ||
| 34 | + ``` | ||
| 35 | + docker run --rm -v $(pwd):/data openeuler/nco:{Tag} ncra -O in.nc avg.nc | ||
| 36 | + ``` | ||
| 37 | + | ||
| 38 | + - 交互式进入容器依次执行多个操作符: | ||
| 39 | + ``` | ||
| 40 | + docker run -it --rm -v $(pwd):/data openeuler/nco:{Tag} /bin/bash | ||
| 41 | + ``` | ||
| 42 | + | ||
| 43 | +license: 3-Clause BSD License | ||
| 44 | +similar_packages: | ||
| 45 | + - ncl: NCAR Command Language,气候和天气数据处理与可视化工具 | ||
| 46 | + | ||
| 47 | +dependency: | ||
| 48 | + - netcdf | ||
| 49 | + - hdf5 | ||
| 50 | + - gsl | ||
| 51 | + - antlr-C++ | ||
| 52 | + - perl | ||
| 53 | + | ||
| 54 | +homepage: http://nco.sf.net | ||
| 55 | +upstream: | ||
| 56 | + backend: GitHub | ||
| 57 | + version_url: nco/nco | ||
| 58 | + version_prefix: | ||
| 59 | + version_filter: rc;candidate;beta;pre | ||
| 60 | + version_scheme: RPM | ||
| @@ -0,0 +1,2 @@ | |||
| 1 | +5.4.0-alpha04-oe2403sp4: | ||
| 2 | + path: 5.4.0-alpha04/24.03-lts-sp4/Dockerfile | ||
| @@ -0,0 +1,2 @@ | |||
| 1 | + | ||
| 2 | +<testsuite name="nco-aarch64" tests="1" failures="0" errors="0" time="7.287"><testcase classname="native-image-validation" name="build-runtime-tests" time="7.287" /></testsuite> | ||
| @@ -0,0 +1,13 @@ | |||
| 1 | +{ | ||
| 2 | + "Model": "x86_64=oe-image-x86; aarch64=oe-image-arm64", | ||
| 3 | + "architecture": "x86_64,aarch64", | ||
| 4 | + "cpu_cores": 32, | ||
| 5 | + "cpu_model": "x86_64=0; aarch64=0", | ||
| 6 | + "kernel": "x86_64=6.6.0-159.4.3.154.oe2403sp4.x86_64; aarch64=6.6.0-132.0.0.111.oe2403sp3.aarch64", | ||
| 7 | + "numpy_version": "x86_64=not-installed; aarch64=not-installed", | ||
| 8 | + "os": "x86_64=openEuler 24.03 (LTS-SP4); aarch64=openEuler 24.03 (LTS-SP3)", | ||
| 9 | + "python_version": "x86_64=3.11.6; aarch64=3.11.6", | ||
| 10 | + "software_name": "nco", | ||
| 11 | + "software_version": "5.4.0-alpha04", | ||
| 12 | + "test_time": "2026-08-13T03:14:01Z" | ||
| 13 | +} | ||
| @@ -0,0 +1,2 @@ | |||
| 1 | + | ||
| 2 | +<testsuite name="nco-x86_64" tests="1" failures="0" errors="0" time="5.547"><testcase classname="native-image-validation" name="build-runtime-tests" time="5.547" /></testsuite> | ||
| @@ -0,0 +1,142 @@ | |||
| 1 | +#!/bin/bash | ||
| 2 | +set -euo pipefail | ||
| 3 | + | ||
| 4 | +: "${EXPECTED_VERSION:?EXPECTED_VERSION is required}" | ||
| 5 | + | ||
| 6 | +test_version() { | ||
| 7 | + local output line version="" rc=0 | ||
| 8 | + | ||
| 9 | + if ! command -v ncks >/dev/null 2>&1; then | ||
| 10 | + printf 'FAIL: ncks binary not found in image\n' >&2 | ||
| 11 | + return 1 | ||
| 12 | + fi | ||
| 13 | + | ||
| 14 | + if output="$(ncks --version 2>&1)"; then | ||
| 15 | + : | ||
| 16 | + else | ||
| 17 | + rc=$? | ||
| 18 | + printf 'FAIL: ncks --version exited %s:\n%s\n' "${rc}" "${output}" >&2 | ||
| 19 | + return 1 | ||
| 20 | + fi | ||
| 21 | + | ||
| 22 | + while IFS= read -r line; do | ||
| 23 | + case "${line}" in | ||
| 24 | + "ncks version "*) | ||
| 25 | + version="${line#ncks version }" | ||
| 26 | + break | ||
| 27 | + ;; | ||
| 28 | + esac | ||
| 29 | + done <<< "${output}" | ||
| 30 | + | ||
| 31 | + if [[ -z "${version}" ]]; then | ||
| 32 | + printf 'FAIL: "ncks version" line not found in output:\n%s\n' "${output}" >&2 | ||
| 33 | + return 1 | ||
| 34 | + fi | ||
| 35 | + | ||
| 36 | + if [[ "${version}" != "${EXPECTED_VERSION}" ]]; then | ||
| 37 | + printf 'FAIL: version mismatch: expected=<%s> actual=<%s>\n' \ | ||
| 38 | + "${EXPECTED_VERSION}" "${version}" >&2 | ||
| 39 | + return 1 | ||
| 40 | + fi | ||
| 41 | + | ||
| 42 | + printf 'PASS: exact version: %s\n' "${version}" | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +test_core_function() { | ||
| 46 | + local workdir in_cdl in_nc att_nc sq_nc output out_norm val rc=0 | ||
| 47 | + | ||
| 48 | + workdir="$(mktemp -d)" | ||
| 49 | + in_cdl="${workdir}/tst.cdl" | ||
| 50 | + in_nc="${workdir}/in.nc" | ||
| 51 | + att_nc="${workdir}/att.nc" | ||
| 52 | + sq_nc="${workdir}/sq.nc" | ||
| 53 | + | ||
| 54 | + printf '%s\n' \ | ||
| 55 | + 'netcdf tst {' \ | ||
| 56 | + 'dimensions:' \ | ||
| 57 | + ' time = 4 ;' \ | ||
| 58 | + 'variables:' \ | ||
| 59 | + ' double time(time) ;' \ | ||
| 60 | + ' double temp(time) ;' \ | ||
| 61 | + ' temp:units = "K" ;' \ | ||
| 62 | + 'data:' \ | ||
| 63 | + ' time = 0., 1., 2., 3. ;' \ | ||
| 64 | + ' temp = 0., 2., 4., 6. ;' \ | ||
| 65 | + '}' > "${in_cdl}" | ||
| 66 | + | ||
| 67 | + if ncgen -o "${in_nc}" "${in_cdl}" 2>"${workdir}/ncgen.err"; then | ||
| 68 | + : | ||
| 69 | + else | ||
| 70 | + rc=$? | ||
| 71 | + printf 'FAIL: ncgen exited %s: %s\n' "${rc}" "$(cat "${workdir}/ncgen.err")" >&2 | ||
| 72 | + return 1 | ||
| 73 | + fi | ||
| 74 | + | ||
| 75 | + if ncatted -O -a long_name,temp,c,c,Temperature "${in_nc}" "${att_nc}" \ | ||
| 76 | + 2>"${workdir}/ncatted.err"; then | ||
| 77 | + : | ||
| 78 | + else | ||
| 79 | + rc=$? | ||
| 80 | + printf 'FAIL: ncatted exited %s: %s\n' "${rc}" "$(cat "${workdir}/ncatted.err")" >&2 | ||
| 81 | + return 1 | ||
| 82 | + fi | ||
| 83 | + | ||
| 84 | + if output="$(ncks -m "${att_nc}" 2>&1)"; then | ||
| 85 | + : | ||
| 86 | + else | ||
| 87 | + rc=$? | ||
| 88 | + printf 'FAIL: ncks -m exited %s:\n%s\n' "${rc}" "${output}" >&2 | ||
| 89 | + return 1 | ||
| 90 | + fi | ||
| 91 | + if [[ "${output}" != *'temp:long_name = "Temperature"'* ]]; then | ||
| 92 | + printf 'FAIL: created attribute long_name="Temperature" not found in metadata:\n%s\n' "${output}" >&2 | ||
| 93 | + return 1 | ||
| 94 | + fi | ||
| 95 | + printf 'PASS: ncatted write + ncks -m readback of attribute\n' | ||
| 96 | + | ||
| 97 | + if ncap2 -s 'temp_sq=temp*temp' -O "${att_nc}" "${sq_nc}" 2>"${workdir}/ncap2.err"; then | ||
| 98 | + : | ||
| 99 | + else | ||
| 100 | + rc=$? | ||
| 101 | + printf 'FAIL: ncap2 exited %s: %s\n' "${rc}" "$(cat "${workdir}/ncap2.err")" >&2 | ||
| 102 | + return 1 | ||
| 103 | + fi | ||
| 104 | + | ||
| 105 | + if output="$(ncks -H -v temp_sq "${sq_nc}" 2>&1)"; then | ||
| 106 | + : | ||
| 107 | + else | ||
| 108 | + rc=$? | ||
| 109 | + printf 'FAIL: ncks -H exited %s:\n%s\n' "${rc}" "${output}" >&2 | ||
| 110 | + return 1 | ||
| 111 | + fi | ||
| 112 | + out_norm="$(printf '%s' "${output}" | tr -d '[:space:]')" | ||
| 113 | + for val in 'temp_sq=0,4,16,36;'; do | ||
| 114 | + if [[ "${out_norm}" != *"${val}"* ]]; then | ||
| 115 | + printf 'FAIL: computed value <%s> not found in ncks output:\n%s\n' "${val}" "${output}" >&2 | ||
| 116 | + return 1 | ||
| 117 | + fi | ||
| 118 | + done | ||
| 119 | + printf 'PASS: ncap2 computed temp_sq=temp*temp and ncks read back all values\n' | ||
| 120 | + | ||
| 121 | + rm -rf "${workdir}" | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +main() { | ||
| 125 | + local failures=0 | ||
| 126 | + | ||
| 127 | + if ! test_version; then | ||
| 128 | + failures=$((failures + 1)) | ||
| 129 | + fi | ||
| 130 | + if ! test_core_function; then | ||
| 131 | + failures=$((failures + 1)) | ||
| 132 | + fi | ||
| 133 | + | ||
| 134 | + if (( failures > 0 )); then | ||
| 135 | + printf 'TESTS_FAILED: %s failure(s)\n' "${failures}" >&2 | ||
| 136 | + return 1 | ||
| 137 | + fi | ||
| 138 | + | ||
| 139 | + printf 'ALL_TESTS_PASSED\n' | ||
| 140 | +} | ||
| 141 | + | ||
| 142 | +main "$@" | ||