Skip to main content

gcmtools

By Adiv Paradise

DEPENDENCIES: matplotlib, numpy, basemap, python-netcdf4 OPTIONAL (for interactive plots): nodejs, jupyter-widgets, jupyter-matplotlib

This is a collection of custom functions, wrappers, and other tools to make analyzing output from a gcm just slightly easier. Mostly it functions as a wrapper for matplotlib and basemap, but it includes useful things like a function for area-weighted math and a function for computing the streamfunction and plotting the Hadley cells.

Installation

You can either download and build/use from this repository, or you can use pip:

pip install gcmtools

Usage

parse(filename,variable,\*\*kwargs)

Returns the data contained in variable, along with the latitude and longitude arrays.

* filename

    Specifies the name of the netCDF4 file to open

* variable

    Specifies the variable name to use

* lat (optional)

    What name to use for the latitude array when parsing the file

* lon (optional)

    What name to use for the longitude array when parsing the file

make2d(variable,\*\*kwargs)

Returns a 2D slice of the given variable

* variable

    The data array to slice

* ignoreNaNs (optional)

    Ignore NaNs when doing arithmetic operations (default=True)

* lat (optional)

    type(int): slice the array at this latitude
    "sum": Take the meridional sum
    "mean": Take the meridional mean

* lon (optional)

    type(int): slice the array at this longitude
    "sum" Take the zonal sum
    "mean": Take the zonal mean

* lev (optional)

    type(int): slice the array at this vertical level
    "sum" Take the column sum
    "mean": Take the column mean

* time (optional)

    type(int): Take the snapshot of the array at this time
    None (default): Take the time-average of the data

spatialmath(variable,\*\*kwargs)

Returns the area-weighted average or sum of the given variable

* variable

    Either the name of the variable to use, or the data array itself.
    If the file keyword is used, this should be the variable name. If
    not, then the lat and lon arrays must be provided.

* file (optional)

    The name of the file from which to extract the data

* lat (optional)

    The latitude array to use (ignored if file keyword is used)

* lon (optional)

    The longitude array to use (ignored if file keyword is used)

* lev (optional)

    The level slice to use (see make2d() keyword options)

* time (optional)

    type(int): Use the snapshot of the variable at this time
    None (default): Use the time-average of the variable

* mean (optional)

    If True (default), the global mean will be calculated. If False,
    only the global sum will be returned.

* radius (optional)

    The physical radius of the sphere with which to scale the sum 
    (if not computing the mean)

wrap2d(variable)

Add a longitude column to a 2D lat-lon array, and fill it with the first column

pcolormesh(variable,\*\*kwargs)

Create and return a pcolormesh object showing variable. \*\*kwargs can include all normal pcolormesh keyword arguments, and if the 'projection' keyword argument is specified, \*\*kwargs can also contain any Basemap arguments.

gcmtools-specific arguments:

* invertx

    Invert the x-axis. This is analogous to plt.gca().invert_xaxis()

* inverty

    Invert the y-axis. This is analogous to plt.gca().invert_yaxis()

* symmetric

    If True, compute a colormap normalization which is symmetric about zero.
    If not None and equal to a number, compute a colormap normalization 
    symmetric about that number. Useful for divergent colormaps.

Example:

pcolormesh(temperature,x=lons,y=lats,projection='moll',lon_0=0,cmap='RdBu_r',symmetric=273.15)

hadley(filename,\*\*kwargs)

Compute the streamfunction, and plot the zonal mean as a function of latitude and pressure. Optionally overplot zonal wind contours.

* filename

   File from which to extract the streamfunction.

* contours (optional)

   If True, compute the mean zonal wind and overplot it as a series of labeled contours.

* ylog (optional)

   If True, use a logarithmic scale on the y-axis (corresponding to being linear in altitude).

Metadata

Release files for gcmtools 0.5.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 gcmtools 0.5.8
File Size Uploaded Provenance Actions
gcmtools-0.5.8.tar.gz 23.1 kB Without provenance Details for gcmtools-0.5.8.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for gcmtools 0.5.8
File Interpreter ABI Platform Actions
gcmtools-0.5.8-py3-none-any.whl Python 3 none any Details for gcmtools-0.5.8-py3-none-any.whl
gcmtools-0.5.8-py2-none-any.whl Python 2 none any Details for gcmtools-0.5.8-py2-none-any.whl

Total release size: 63.1 kB

Release files / gcmtools-0.5.8.tar.gz

Download URL gcmtools-0.5.8.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
10897f4d686c3d92711de3f8ba095e0decba33cd77d845c7944bd915356dce8d
BLAKE2b-256 checksum
How to use checksums
f8a8374cfc0853b446c5786781c30859234b7a28fdc0474948842d4f903ec204
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.5.2

Release files / gcmtools-0.5.8-py3-none-any.whl

Download URL gcmtools-0.5.8-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
073b156c1caff616b6ce6d3549b69eef31f5869b42491f46f605b81a7f56e413
BLAKE2b-256 checksum
How to use checksums
0d45241da0932f6a661363959137dd35c1df86f50bad129bba9775b4e8ab4c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.5.2

Release files / gcmtools-0.5.8-py2-none-any.whl

Download URL gcmtools-0.5.8-py2-none-any.whl
Size 20.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
8b8c7e1a68b9851bb1e579ab1c77cb48dc048da99508b169713b785b191783bc
BLAKE2b-256 checksum
How to use checksums
95f9aba5b65784b008dcca86bea7ac1fe9d422f5adbcf2307c9aaf5e22144f64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.5.2

Security for gcmtools 0.5.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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