Skip to main content

Tools for running and analysing UCLA-ROMS simulations

Project description

ROMS-tools

Overview

A suite of python tools for setting up a ROMS simulation.

Note these tools are for the Center for Earth Systems Research Group at UCLA's version of ROMS.

Installation instructions

Install via pip

pip install roms-tools

Check the installation has worked by running the tests (you will need to also install pytest to run these)

pytest

Dependencies required are xarray and netcdf4, plus matplotlib and cartopy for visualising grids.

ROMS-tools should run on any platform that can install the above dependencies.

Usage instructions

To set up all the input files for a new ROMS simulation from scratch, follow these steps in order.

Step 1: Make Grid

The first step is choosing the domain size, location, and resolution. Do this by creating an instance of the Grid class:

from roms_tools import Grid

grid = Grid(
    nx=100,          # number of points in the x-direction (not including 2 boundary cells on either end)
    ny=100,          # number of points in the y-direction (not including 2 boundary cells on either end)
    size_x=1800,     # size of the domain in the x-direction (in km)
    size_y=2400,     # size of the domain in the y-direction (in km)
    center_lon=-21,  # longitude of the center of the domain
    center_lat=61,   # latitude of the center of the domain
    rot=20,          # rotation of the grid's x-direction from lines of constant longitude, with positive values being a counter-clockwise rotation
)

To visualize the grid we have just created, use the .plot method:

grid.plot()

iceland_grid

To see the values of the grid variables you can examine the xarray.Dataset object returned by the .ds property

grid.ds
<xarray.Dataset>
Dimensions:    (eta_rho: 3, xi_rho: 3, one: 1)
Dimensions without coordinates: eta_rho, xi_rho, one
Data variables:
    angle      (eta_rho, xi_rho) float64 0.0 0.0 0.0 -1.46e-16 ... 0.0 0.0 0.0
    f0         (eta_rho, xi_rho) float64 4.565e-06 4.565e-06 ... -4.565e-06
    pn         (eta_rho, xi_rho) float64 5e-06 5e-06 5e-06 ... 5e-06 5e-06 5e-06
    lon_rho    (eta_rho, xi_rho) float64 339.1 340.0 340.9 ... 339.1 340.0 340.9
    lat_rho    (eta_rho, xi_rho) float64 1.799 1.799 1.799 ... -1.799 -1.799
    spherical  (one) <U1 'T'
    tra_lon    (one) int64 -20
    tra_lat    (one) int64 0
    rotate     (one) int64 0
Attributes:
    Title:    ROMS grid. Settings: nx: 1 ny: 1  xsize: 0.1 ysize: 0.1 rotate:...
    Date:     2023-11-20
    Type:     ROMS grid produced by roms-tools

Once we are happy with our grid, we can save it as a netCDF file via the .save method:

grid.save('grids/my_new_roms_grid.nc')

The basic grid domain is now ready for use by ROMS.

Steps 2-7:

Coming soon!

Feedback and contributions

If you find a bug, have a feature suggestion, or any other kind of feedback, please start a Discussion.

We also accept contributions in the form of Pull Requests.

See also

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

roms-tools-0.0.6.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

roms_tools-0.0.6-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file roms-tools-0.0.6.tar.gz.

File metadata

  • Download URL: roms-tools-0.0.6.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for roms-tools-0.0.6.tar.gz
Algorithm Hash digest
SHA256 0fd1b4e8e57dddf6423196a3c60fd1e367ce18ad693860b90e46b81ce4ee5011
MD5 608f1dd89db70fbe9770fa43cbc08c86
BLAKE2b-256 d8b4a489ccb53629f16c392f3b3dbf61fd2cf3d514e4b29e86429a134341bcc3

See more details on using hashes here.

Provenance

File details

Details for the file roms_tools-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: roms_tools-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for roms_tools-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d50596be370a678786ad8685f20234ebfea4fbb894a09d55c3a914abda459c70
MD5 8ff73e56edf240dcae50ac606a65967d
BLAKE2b-256 aec18ed48c4d5661a465695536668e9cf6a5d66bc4ff0e3f10ac6168e40dd194

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page