Skip to main content

cimiss-python

CIMISS client for Python 3

Installation

Python >= 3.6

Ubuntu

sudo apt install -y build-essential libssl-dev libbz2-dev
pip install cimiss-python

Windows

pip install cimiss-python

CentOS

sudo yum groupinstall "Development Tools"
sudo yum -y install zlib-devel bzip2-devel openssl-devel
pip install cimiss-python

Usage

CIMISS-MUSIC仅为内网用户提供服务,且需要拥有相应数据访问权限的账号。

import cimiss
import numpy as np

# host 不带http前缀,通常为纯ip地址  (client实例使用完成后需要调用destroy方法手动注销,或者使用下面的with语句自动管理)
client = cimiss.Query(user_id='myuserid', password='mypasswd', host='myhost')


# callAPI_to_array2D
# array_2d(interface_id: str, params: Dict[str, str], dtypes: Optional[Dict[str, Union[str, np.dtype]]]) -> pd.DataFrame
resp_array_2d = client.array_2d(
    interface_id="getSurfEleByTime",
    params={
        "dataCode": "SURF_CHN_MUL_HOR",
        "elements": "Station_ID_C,PRE_1h,PRS",
        "times": "20181224000000",
        "orderby": "Station_ID_C:ASC",
        "limitCnt": "10",
    },
    dtypes={'PRE_1h': np.float, 'PRS': np.float}
)
# pandas
# https://pandas.pydata.org/pandas-docs/stable/
# dtypes参数字典value也可为字符串 例如 {'PRE_1h': 'float', 'PRS': 'float32'}


# callAPI_to_gridArray2D
# grid_array_2d(interface_id: str, params: Dict[str, str]) -> xr.DataArray
resp_grid = client.grid_array_2d(
    interface_id="getNafpEleGridByTimeAndLevelAndValidtime",
    params={
        "dataCode": "NAFP_FOR_FTM_HIGH_EC_ANEA",
        "fcstEle": "TEM",
        "time": "20191206000000",
        "fcstLevel": "1000",
        "validTime": "0",
    },
)
# xarray
# http://xarray.pydata.org/en/stable/


# callAPI_to_fileList
# def file_list(interface_id: str, params: Dict[str, str]) -> pd.DataFrame


# callAPI_to_saveAsFile
# save_file(interface_id: str, params: Dict[str, str], data_format: str, file_name: str, follow_host: Union[bool, str] = False) -> str
# follow_host可以为bool或str
#   False时使用接口返回的默认下载主机
#   True时则下载主机强行跟随host:80
#   str时则为指定的主机 (x.x.x.x:x 形式 端口为80时可省略端口)

# callAPI_to_downFile
# down_file(interface_id: str, params: Dict[str, str], file_dir: str, follow_host: Union[bool, str] = False) -> List[str]#

# 实例使用完成后需要进行注销
client.destroy()

除此之外还可以使用with语句自动管理

import cimiss

with cimiss.Query(user_id='myuserid', password='mypasswd', host='myhost') as client:
    # client.array_2d ......
    pass

# 在with语句块之外会自动对实例进行注销,无需手动管理

FAQ

A: IcePy.cpython-36m-x86_64-linux-gnu.so: undefined symbol: SSLeay

Q: Update the system OpenSSL library version to 1.1.x (升级系统OpenSSL依赖库版本)

Metadata

Release files for cimiss-python 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cimiss-python 0.1.8
File Size Uploaded
cimiss-python-0.1.8.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cimiss-python 0.1.8
File Interpreter ABI Platform
cimiss_python-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 35.4 kB

Release files / cimiss-python-0.1.8.tar.gz

Download URL cimiss-python-0.1.8.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4959b23151c349b7dff01ac02247f44e078c2d1c39c222d67ea8c73a5d5a1d88
BLAKE2b-256 checksum
How to use checksums
01c95a74bf365a57a462c60df65ea22b0c25847c600079cd3466f5793977af10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / cimiss_python-0.1.8-py3-none-any.whl

Download URL cimiss_python-0.1.8-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51da5afb350767401f1791bf7fc054bd9abab6aeaaceb8d344b43356f881f644
BLAKE2b-256 checksum
How to use checksums
ef46a74f428e747c005b0bd59ff4eed8458ea5bb2e824aeb157c60e658d3e930
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page