Skip to main content

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 regular variable
    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:

from pynetcdf import netcdf_file

class Test(NetCDF):
    loader = netcdf_file
    ...

Changelog:

0.1.1   Added pupynere dependency.
0.1     Initial release.

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

Puppy-0.1.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

Puppy-0.1.1-py2.6.egg (3.9 kB view details)

Uploaded Source

File details

Details for the file Puppy-0.1.1.tar.gz.

File metadata

  • Download URL: Puppy-0.1.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Puppy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 820a0e5a2fce46b71b6f113d5e4e2bfe44023d59e79b9ce8a2f52cfd5a61d58d
MD5 f85c81d563cad072d155e86b2932b5a9
BLAKE2b-256 76c1ac278d858906b7b8c9606d75552e57eb935dbbbfa46c7331a74b1bd0e934

See more details on using hashes here.

Provenance

File details

Details for the file Puppy-0.1.1-py2.6.egg.

File metadata

  • Download URL: Puppy-0.1.1-py2.6.egg
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Puppy-0.1.1-py2.6.egg
Algorithm Hash digest
SHA256 b769aa8e304f85c302e183d046f762a5fee32d8f48bf0961df65236b6177be59
MD5 184aeec4fb32258a9cf04da953b6af8b
BLAKE2b-256 3498c93618c5f60a7ec7c286c86a6d625242ae0bf17a1da40881cdbcb2928c78

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