DSL for creating NetCDF files
Project description
A DSL for creating NetCDF files. Here’s a simple example:
from pup import * class Test(NetCDF): # NC_GLOBAL attributes go here history = 'Created for a test' # dimensions need to be set explicitly only when they # have no variable associated with them dim0 = Dimension(2) # variables that don't specify dimensions are assumed to # be their own dimension time = Variable(range(10), record=True, units='days since 2008-01-01') # now a variable with dimensions (time,) temperature = Variable(range(10), (time,), units='deg C') Test.save('simple.nc')
This will produce the following NetCDF file:
netcdf simple { dimensions: dim0 = 2 ; time = UNLIMITED ; // (10 currently) variables: int time(time) ; time:units = "days since 2008-01-01" ; int temperature(time) ; temperature:units = "deg C" ; // global attributes: :history = "Created for a test" ; data: time = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ; temperature = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ; }
By default it uses pupynere for creating files, but this can be overloaded; we can use the netCDF4 module, for example, which allows us to specify groups:
from netCDF4 import Dataset class Test(NetCDF): loader = Dataset ... foo = Group( dim = Dimension(10), var = Variable(range(10)), ... ) Test.save('simple.nc', format='NETCDF4')
Changelog:
- 0.1.5:
Added support for Groups when using netcdf4.
- 0.1.4:
Added support for masked arrays.
- 0.1.3:
Pass keyword arguments in save() to the loader.
- 0.1.2:
Improved optional loader detection.
- 0.1.1:
Added pupynere dependency.
- 0.1:
Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Puppy-0.1.5.tar.gz
(3.2 kB
view details)
Built Distribution
Puppy-0.1.5-py2.7.egg
(4.6 kB
view details)
File details
Details for the file Puppy-0.1.5.tar.gz
.
File metadata
- Download URL: Puppy-0.1.5.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fda6cf54c382e2594d7260863c656778f9373fc1bde74fda3eb6a4b801f4be19 |
|
MD5 | 589d4ec99129d00cae44b45a048490d5 |
|
BLAKE2b-256 | 7bf6f682fcac1cfda6149bb1c45ef802023551951fd15949382cf6481c7a3990 |
Provenance
File details
Details for the file Puppy-0.1.5-py2.7.egg
.
File metadata
- Download URL: Puppy-0.1.5-py2.7.egg
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d510a5ec188404c8c05c109fa93dfdb7c78176bd58d299e097ba08c3f23f2745 |
|
MD5 | edd068ca6e83b153ec736d64eb8e444c |
|
BLAKE2b-256 | da6d26ca921802d1b03e0ad37dcb47fe9e3a611219e34a30907d32c10397beda |