Skip to main content

Spacegrids

Spacegrids is an open source library providing a Numpy array with grids, labelled axes and associated grid-related mathematical methods such as regridding and integration. Spacegrids provides an object data model of Netcdf data that ensures consistency between a Numpy data array and its grid under common operations (and so avoiding common pitfalls related to axis interpretation), and much more. It is a write less do more library for everyday use.

These interactive plots from Netcdf data are based on Spacegrids.

The Field, Gr (grid) and Coord objects make everyday use easy:

>>> import spacegrids as sg
>>> D = sg.info(nonick = True)
>>> P = sgPproject(D['my_project'] , nonick = True)
>>> P.load(['temperature','u'])
>>> # obtain the axes objects under their names T,X,Y,Z:
>>> for c in P['some_experiment'].axes:
>>>   exec c.name + ' = c'  # now we can refer to X,Y
>>> TEMP = P['some_experiment']['temperature']
>>> U = P['some_experiment']['u'] # zonal velocity
>>> TEMP_sliced = TEMP[Y,:50] # slice. Note Y axis object
>>> m_TEMP = TEMP_sliced/(X*Y) # take hor. mean
>>> TEMP_regridded = TEMP.regrid(U.gr)  # U grid differs

Features

  • A numpy array with grid allowing automatic alignment and dimension broadcasting

  • Easy to use and intuitive regridding functionality

  • A data object model corresponding closely to Netcdf

  • Easier IO via abstraction of IO with multiple Netcdf files

  • Makes working with output of many experiments easy via aggregation methods

  • The Field class eliminates errors arising from picking the wrong array index

  • Quicker plotting due to automatic labels, axes etc.

  • Distance-related methods such as spatial differentiation and integration on sphere

  • Extensive unit tests and documentation

There is lots of documentation, both in the source code and elsewhere. Other documentation can be found at:

Installation

Install spacegrids simply by running (on command line):

pip install spacegrids

Dependencies: numpy, scipy, matplotlib (NetCDF4 optional). On Ubuntu/ Debian, install dependencies via package manager if pip install fails:

apt-get install python-{tk,numpy,matplotlib,scipy}

On Mac, pip can be installed via “sudo easy_install pip”.

Contribute

  • Issue Tracker: github.com/willo12/spacegrids/issues

  • Source Code: github.com/willo12/spacegrids

Support

If you are having issues, please let us know.

License

The project is licensed under the BSD license.

Release files for spacegrids 1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spacegrids 1.9
File Size Uploaded
spacegrids-1.9.tar.gz 91.6 kB Details

Release files / spacegrids-1.9.tar.gz

Download URL spacegrids-1.9.tar.gz
Size 91.6 kB
Tags Source
SHA-256 checksum
How to use checksums
79bce87fb777899b0d014c1222e645849fab3c2f815bd44899f766a37d592d30
BLAKE2b-256 checksum
How to use checksums
272fae92422f65f2c76c9c9a5fcdaff39df466b7d223f241eb6ddfda50ca2238
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.9 This release

1 release file

1.8

1 release file

1.7.1

1.7

2 release files

1.6.30

2 release files

1.6.29

2 release files

1.6.28

2 release files

1.6.27

2 release files

1.6.26

2 release files

1.6.25

2 release files

1.6.18

2 release files

1.6.13

2 release files

1.6.12

2 release files

1.6.11

2 release files

1.6.10

2 release files

1.6.9

2 release files

1.6.8

2 release files

1.6.7

2 release files

1.6.6

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.10

2 release files

1.4.9

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

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