Skip to content

Commit

Permalink
add pyscream docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mahf708 committed Nov 14, 2024
1 parent 0336fa3 commit 7030371
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
73 changes: 73 additions & 0 deletions components/eamxx/docs/user/pyscream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# PySCREAM

PySCREAM is currently under heavy development and may contain some
rough edges. If you encounter any issues, please report them on the
team on
[github discussions](https://github.com/E3SM-Project/E3SM/labels/eamxx).
Likewise, if you have questions or would like to request features,
please post them on the
[github discussions](https://github.com/E3SM-Project/E3SM/labels/eamxx).

## Quick Start

For now, the only way to use pyscream is to either build it on your own
or use our prebuilt conda binaries. We prefer for you to use the latter.
In a conda environment, please use the following command to install it:

```bash
conda install -c mahf708 pyscream=0.0.2
```

It is recommended to use the latest version of pyscream, wich is
currently 0.0.2. As you can see, it is a young package with a lot of
potential. We do not guarantee that the API will remain stable, but we
will try to document any changes as frequently as we could.

## Examples

We provide an example to demo calling the radiation process (RRTMGP).
More examples are on the way. If you'd like to add your example,
please feel free to submit a PR.

### RRTMGP

```python
from mpi4py import MPI
import pyscream

pyscream.init()

dt = 1800
t0_str = "2020-10-10-00000"

ic_file = "/lcrc/group/e3sm/public_html/inputdata/atm/scream/init/screami_unit_tests_ne2np4L72_20220822.nc"
ncols = 218
nlevs = 72
pyscream.create_grids_manager(ncols,nlevs, ic_file)

rad_dict = {
"column_chunk_size": 123,
"active_gases": ["h2o", "co2", "o3", "n2o", "co" , "ch4", "o2", "n2"],
"orbital_year": 1990,
"log_level": "info",
"do_aerosol_rad": False,
"rrtmgp_coefficients_file_sw": "/lcrc/group/e3sm/data/inputdata/atm/scream/init/rrtmgp-data-sw-g112-210809.nc",
"rrtmgp_coefficients_file_lw": "/lcrc/group/e3sm/data/inputdata/atm/scream/init/rrtmgp-data-lw-g128-210809.nc",
"rrtmgp_cloud_optics_file_sw": "/lcrc/group/e3sm/data/inputdata/atm/scream/init/rrtmgp-cloud-optics-coeffs-sw.nc",
"rrtmgp_cloud_optics_file_lw": "/lcrc/group/e3sm/data/inputdata/atm/scream/init/rrtmgp-cloud-optics-coeffs-lw.nc",
}

rad = pyscream.AtmProc(rad_dict, 'RRTMGP')
rad.read_ic(ic_file)
rad.initialize(t0_str)

t = rad.get_field("T_mid")
tm = t.get()

print(tm[5,5], flush=True)

rad.run(dt)
rad.run(dt)

print(tm[5,5], flush=True)
```
1 change: 1 addition & 0 deletions components/eamxx/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ nav:
- 'COSP': 'user/cosp.md'
- 'Regionally Refined EAMxx': 'user/rrm_eamxx.md'
- 'Doubly Periodic EAMxx': 'user/dp_eamxx.md'
- 'PySCREAM': 'user/pyscream.md'
- 'Developer Guide':
- 'Overview': 'developer/index.md'
- 'Installation': 'common/installation.md'
Expand Down

0 comments on commit 7030371

Please sign in to comment.