# python-runtime

> 基于python-bridge的python脚本运行环境(netCDF4-python、h5py、gdal)

Latest version **1.0.0** (published 2019-05-29) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install python-runtime
pnpm add python-runtime
yarn add python-runtime
bun add python-runtime
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-05-29 |
| First published | 2019-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 62.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | yes |
| Author | weixiuyong |
| Maintainers | weixiuyong |
| Keywords | python, python-node, netCDF4-python, gdal-python, h5py, python-runtime |

## Links

- npm: https://www.npmjs.com/package/python-runtime
- npm.io page: https://npm.io/package/python-runtime

## Dependencies (4)

- [unzip](https://npm.io/package/unzip.md) ^0.1.11
- [ndarray](https://npm.io/package/ndarray.md) ^1.0.18
- [request](https://npm.io/package/request.md) ^2.88.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.0

## Recent versions

- 1.0.0 (latest) — 2019-05-29
- 0.6.0 — 2019-05-29
- 0.5.0 — 2019-05-29
- 0.4.0 — 2019-05-28
- 0.3.0 — 2019-05-04
- 0.2.0 — 2019-05-04
- 0.1.0 — 2019-05-04

## README

# 基于python-bridge的python脚本运行环境
## 环境依赖
* nodejs
* python 
* windows平台上自动安装配置好的python，其中包含了netCDF4-python、h5py、gdal等常用的气象和遥感数据处理相关python库。
* mac os、linux等平台上需另外安装配置python环境 
## 使用示例
js代码
``` javascript

(async function () {
    var path = require('path')
    var Python = require('./index')
    var python = new Python({
        "searchPaths": [
            path.join(__dirname, 'pythonScripts')
        ]
    })
    await python.exec('from netCDF4_node import *').catch((err) => {
        python.close();
        throw err
    })
    var ncOrHdf5FileName = path.join(__dirname, 'sampleData/FY4A-_AGRI--_N_REGC_1047E_L2-_CTT-_MULT_NOM_20190210073834_20190210074250_4000M_V0001.NC')
    var result = await python.eval('readFile("' + ncOrHdf5FileName + '")')
        .catch((err) => {
            python.close();
            throw err
        })
    console.log(result)
    python.close();
})()
```
输出结果：
``` json 
Variable {name: "CTT", attributes: Object, dataType: "float32", shape: Array(2), data: Float32Array(3044784), …}
index.js:29
65535
index.js:30
Array(2) [180, 311.4605712890625]
```

---
_Source: https://npm.io/package/python-runtime · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
