安装nceplibs

安装nceplibs

软件版本
cmake3.27.4
miniconda3py39_4.9.2
nceplibs-bufr-bufr12.0.0
节点IP系统功能CPU内存硬盘
node110.80.10.1centos7.9nceplibs4核心8GB20GB

node1

下载安装miniconda3:

下载地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/

1
2
3
4
5
6
7
8
# cd /usr/local/src/
# wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh --no-check-certificate
# bash Miniconda3-py39_4.9.2-Linux-x86_64.sh
回车
一直回车
yes
/usr/local/miniconda3
yes

激活环境:

1
2
3
# source ~/.bashrc
# python -V
Python 3.9.1

下载安装cmake:

下载地址:https://cmake.org/files/v3.27/

1
2
3
4
# cd /usr/local/src/
# wget https://github.com/Kitware/CMake/releases/download/v3.27.4/cmake-3.27.4-linux-x86_64.tar.gz
# tar -xzvf cmake-3.27.4-linux-x86_64.tar.gz
# mv cmake-3.27.4-linux-x86_64 /usr/local/cmake

添加cmake环境变量:

1
2
3
# vim /etc/profile
# 尾行,添加配置
export PATH=$PATH:/usr/local/cmake/bin
1
2
3
4
5
# source /etc/profile
# cmake --version
cmake version 3.27.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).

升级gcc和gfortran:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# yum install -y centos-release-scl
# yum install -y devtoolset-11-gcc devtoolset-11-gcc-gfortran devtoolset-11-gcc-c++
# scl enable devtoolset-11 bash
# echo "source /opt/rh/devtoolset-11/enable" >>/etc/profile
# gfortran --version
GNU Fortran (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# gcc --version
gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

下载安装nceplibs-bufr-bufr:

下载地址:https://github.com/NOAA-EMC/NCEPLIBS-bufr/

1
2
3
4
5
6
7
# cd /usr/local/src/
# wget https://github.com/NOAA-EMC/NCEPLIBS-bufr/archive/refs/tags/bufr_v12.0.0.zip
# unzip bufr_v12.0.0.zip
# cd NCEPLIBS-bufr-bufr_v12.0.0/
# mkdir build && cd build
# cmake -DCMAKE_INSTALL_PREFIX=path1 -DMASTER_TABLE_DIR=path2 -DENABLE_PYTHON=ON ..
# make -j 4 && make -j 4 install

测试数据:

1
2
3
4
5
# pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple/
# cd python/
# python setup.py build
# python setup.py install
# ctest --rerun-failed --output-on-failure

测试代码:

1
2
3
4
# python -c "import ncepbufr"
# cd /usr/local/src/NCEPLIBS-bufr-bufr_v12.0.0/python/test/
# mkdir data
# python test_write.py