<commit_before># cloudrun-python

[![Build Status](https://travis-ci.org/cloudruninc/cloudrun-python.svg?branch=master)](https://travis-ci.org/cloudruninc/cloudrun-python)
[![GitHub issues](https://img.shields.io/github/issues/cloudruninc/cloudrun-python.svg)](https://github.com/cloudruninc/cloudrun-python/issues)

Official Python interface to [Cloudrun API](http://docs.cloudrun.co).

## Installation

```
git clone https://github.com/cloudruninc/cloudrun-python
cd cloudrun-python
pip install -U .
```

To run tests:

```
pytest -v cloudrun/tests.py
```

## Example usage

### Creating and starting a WRF run

```python
from cloudrun import Cloudrun
import os

# Secret token
token = os.environ['CLOUDRUN_API_TOKEN']

# Create API session instance
api = Cloudrun(token)

# Create a new WRF run instance
run = api.create_run(model='wrf', version='3.9')

# Upload input files
for input_file in ['namelist.input', 'wrfinput_d01', 'wrfbdy_d01']:
    run.upload(input_file)

# Start the run using 4 parallel cores
run.start(cores=4) 
```

### Reading WRF output

```python
from cloudrun import Cloudrun
from datetime import datetime
import numpy as np
import os

# Secret token
token = os.environ['CLOUDRUN_API_TOKEN']

# Create API session instance
api = Cloudrun(token)

# Access an existing WRF run
run = api.get_run('ead622aa054040d39c8fd741d19993f0')

# Read 10-m u wind on 2016-12-25 12:00 UTC
field, time, u10 = run.read_output('u10', time1=datetime(2016, 12, 25, 12))
```

[Contact us](mailto:<EMAIL>) to obtain an API token.

## Documentation

Full API documentation is available [here](http://docs.cloudrun.co).

## Questions?

Need help integrating Cloudrun with your app or workflow?
[Let us know](mailto:<EMAIL>)!
<commit_msg>update example<commit_after># cloudrun-python

[![Build Status](https://travis-ci.org/cloudruninc/cloudrun-python.svg?branch=master)](https://travis-ci.org/cloudruninc/cloudrun-python)
[![GitHub issues](https://img.shields.io/github/issues/cloudruninc/cloudrun-python.svg)](https://github.com/cloudruninc/cloudrun-python/issues)

Official Python interface to [Cloudrun API](http://docs.cloudrun.co).

## Installation

```
git clone https://github.com/cloudruninc/cloudrun-python
cd cloudrun-python
pip install -U .
```

To run tests:

```
pytest -v cloudrun/tests.py
```

## Example usage

### Creating and starting a WRF run

```python
from cloudrun import Run
import os

# Secret token
token = os.environ['CLOUDRUN_API_TOKEN']
url = 'https://api.cloudrun.co/v1'

run = Run(url, token)
run.create('wrf', '3.9.1')

# Upload input files
for input_file in ['namelist.input', 'wrfinput_d01', 'wrfbdy_d01']:
    run.upload(input_file)

# Start the run using 4 parallel cores
run.start(cores=4)
```

[Contact us](mailto:<EMAIL>) to obtain an API token.

## Documentation

Full API documentation is available [here](http://docs.cloudrun.co).

## Questions?

Need help integrating Cloudrun with your app or workflow?
[Let us know](mailto:<EMAIL>)!

{'fraction_non_alphanumeric': 0.14333669016448472, 'fraction_numerical': 0.022826451829472977, 'mean_word_length': 5.069246435845214, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 11, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7332004', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1022, 'n_words': 256}