본문 바로가기

python netCDF4 패키지 설치 설치 환경CetOS 7.x, Anaconda3설치 이유pip 에서 관리되는 netCDF4 의 whl 파일은 OS 에 따라 참조 라이브러리가 다름윈도우에서는 Anaconda3 의 라이브러리를 참조리눅스에서는 whl 파일에 라이브러리 포함해당 라이브러리는 HDF4 를 지원하지 않음 참고 링크http://unidata.github.io/netcdf4-python/https://pypi.org/project/netCDF4/https://github.com/Unidata/netcdf4-python netCDF4 패키지는 pip 모듈로 설치할 수 있으나, HDF4를 지원하지 않아 Anaconda3 의 라이브러리를 사용하도록 직접 설치(아래의 방법을 안쓰고 Anaconda3 의 conda-forge 채널을 이용해도 ..
Python ctypes 구조체 사용 Python 의 ctypes 에는 C 언어와 유사한 구조체 기능을 제공한다.(https://docs.python.org/2/library/ctypes.html#structured-data-types) 사용방법은 아래와 같다.12345678910111213import ctypes class my_struct(ctypes.Structure): _fields_ = [ ('data_1', ctypes.c_int), ('data_2', ctypes.c_int8), ('data_3', ctypes.c_uint8), ] print(ctypes.sizeof(my_struct))8 구조체 크기가 alignment 되는 것도 C 언어와 같다.C 에서는 #pragma pack(1) 또는 __attribute__((packe..
julian date 계산 1. datetime 이용123import datetime int(datetime.datetime(2018, 10, 4).strftime("%j")) 2. 직접 계산123456789101112def juldate(year, month, day): jmonth = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334] jday = jmonth[month - 1] + day if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0: if month > 2: return jday + 1 return jday juldate(2018, 10, 4) 2.1. 검증123456789101112131415161718192021im..
docker Tree 확인 잘 만들어진 이미지가 있다...[root@10.9.8.2 ~]# docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz images -t Unable to find image 'nate/dockviz:latest' locally latest: Pulling from nate/dockviz d6bcd48223ce: Pull complete Digest: sha256:0157f9ec324cc8970a7034712c6ccbcfda4778cb7d0c004bbe68e670fbe61b4d Status: Downloaded newer image for nate/dockviz:latest ├─ Virtual Size: 0.0 B │ └─ Vi..
docker registry 생성 자동화 CentOS 7 이상Docker version 18.02.0-ce, build fc4de44 한 번에 생성할 수 있는 스크립트 작성했다. ssh 키가 있어야만 사용 가능 하기에 ID/PW 설정은 의미 없다.그냥 사용할 수 있다는 정도의 의미만 두는 걸로.. 아래의 스크립트들을 한 경로에 넣고 사용 가능 server_setting.sh#!/bin/sh SERVER_NAME=docker_serverSERVER_PORT=5000 REGISTRY_SERVER=$SERVER_NAME:$SERVER_PORT ID=server PW=server create_registry.sh#!/bin/sh my_dir="$(dirname "$0")" source $my_dir/server_setting.sh echo " [req..
docker 사용 설치자동 다운로드 스크립트# curl -fsSL https://get.docker.com/ | sh 서비스 시작 및 조회# systemctl start docker# systemctl status docker이미지 다운로드이미지 검색https://hub.docker.com/ 또는#docker search centos 검색한 이미지 다운로드# docker pull centos:6.9 설치된 이미지 목록 조회# docker images컨테이너 생성 및 실행컨테이너 생성 및 콘솔 연결# docker run -ti --name [image name] centos:6.9 /bin/bash 또는# docker run -ti --rm [image name] [binary] 생성한 컨테이너 실행# docker star..
docker 한글 지원 centos 7 의 docker 이미지는 한글 설치가 되어 있지 않음$ locale -a C POSIX $ locale LANG= LC_CTYPE="POSIX" LC_NUMERIC="POSIX" LC_TIME="POSIX" LC_COLLATE="POSIX" LC_MONETARY="POSIX" LC_MESSAGES="POSIX" LC_PAPER="POSIX" LC_NAME="POSIX" LC_ADDRESS="POSIX" LC_TELEPHONE="POSIX" LC_MEASUREMENT="POSIX" LC_IDENTIFICATION="POSIX" LC_ALL= 아래의 명령을 수행$ localedef -f UTF-8 -i ko_KR ko_KR.utf8 $ export LANG=ko_KR.utf8 $ export..
경로의 파일 시스템 확인 findmnt -T 경로 [root@10.9.8.2 ~]# findmnt -T /lustre TARGET SOURCE FSTYPE OPTIONS /lustre 192.168.30.68@tcp:/DATA lustre rw,flock,lazystatfs [root@10.9.8.2 ~]# findmnt --help Usage: findmnt [options] findmnt [options] | findmnt [options] findmnt [options] [--source ] [--target ] Options: -s, --fstab search in static table of filesystems -m, --mtab search in table of mounted filesystems -k, --kern..