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 ;
}
Compare this with the code necessary to do the same using common NetCDF libraries:
f = netcdf_file("simple.nc", "w")
f.history = "Created for a test"
f.createDimension("dim0", 2)
f.createDimension("time", None)
time = f.createVariable("time", "i", ("time",))
time.units = "days since 2008-01-01"
time[:] = range(10)
temperature = f.createVariable("temperature", "i", ("time",))
temperature.units = "deg C"
temperature[:] = range(10)
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.8:
Ensure record dimensions are created first.
- 0.1.7:
Convert strings to array of chars.
- 0.1.6:
Fix bug in dimension name.
- 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.
Metadata
Release files for Puppy 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Puppy-0.1.8.tar.gz | 3.6 kB | Without provenance | Details for Puppy-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Puppy-0.1.8-py2.7.egg | Legacy Egg format | - | - | Details for Puppy-0.1.8-py2.7.egg |
Total release size: 8.9 kB
Release files / Puppy-0.1.8.tar.gz
| Download URL | Puppy-0.1.8.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19ea7908bc997ab956f8ec79b23d9fcad134d5d72762d2bec97be79043192963
|
|
BLAKE2b-256 checksum How to use checksums |
e6227275af67f649b89a9dd9ea0ca7bbb7155160251b93d616eaa474ad3247e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / Puppy-0.1.8-py2.7.egg
| Download URL | Puppy-0.1.8-py2.7.egg |
|---|---|
| Size | 5.3 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
aee1c9f6c2e1d3e7617c2f1b60748bc03ad2b3d48987a457f9a465793f068eaa
|
|
BLAKE2b-256 checksum How to use checksums |
d2d316fb5a7d3419266ef1e26e39bc6ef12b1f4357672605699e6d2e4980586c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for Puppy 0.1.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.