Detailed API Documentation

catalogue — Database core management


This module needs a lot of cleanups !

Catalogue class manages coherency of the database and underlying storage (i.e. storagesets).

A Catalogue instance has a connection to database (conn) and is able to insert a new dataset (Catalogue.register()) or query database with DAP-like projection and selection constraints (Catalogue.getQueryFileList()).

All configuration parameters are read from pyctoh.ini.

class pyctoh.catalogue.Catalogue

A connection to a database.


Check if dataset is already registered in database.

Returns:dataset_id if dataset is in db, None otherwise
getVariableId(mission_id, param_name)
getXId(sql, args)
get_dataset_ids(projection, selection)

Get ids of datasets that match the given constraints.


a list of dataset_ids matching the given projection and constraints.

Register a dataset in database.

dataset — PyCTOH’s internal format


This module needs a lot of cleanups !

Dataset is PyCTOH’s pivot format for data from GDR.

Dataset loosely maps netCDF concepts of globals, variables, dimensions and attributes.

class pyctoh.dataset.Dataset(mission)

Bases: object

Convert native GDR to netCDF.

  • mission – mission name
  • dimensions – a dictionnary of Dimension objects, keyed by name
  • globals – dictionnary of global variables for this dataset
  • variables – dictionnary of Variable instances, keyed by parameter name.

Get dataset bounding box.

Return (lat_min, lon_min, lat_max, lon_max), or None for empty dataset. lon_min means western bound. lon_max, eastern.


Crop dataset to bounding box.

TODO: handle time_hf (using lon_hf and lat_hf) as well... : if a variable is independant from lon and lat, it is kept as it.


Get min and max values of variable. If variable is “lon”, min and max are the western and eastern bounds longitudes, respectively.

Parameter:variable – variable name
Returns:(min, max ) tuple
reduce(projection, selection)

Reduce dataset according to selection

TODO : handle projection

class pyctoh.dataset.Dimension(name, size, sorted=False)

Bases: object

Dimension object

class pyctoh.dataset.Variable(dtype, dimensions, attributes, values)

Bases: object

PyCTOH’s representation of a variable.

  • dtype – netcdf type of data
  • dimensions – tuple of dimension names
  • attributes – dictionnary of variable’s attributes, keyed by name
  • values – numpy array of content

Utility converter : convert type to netCDF type name.

>>> np2cdf(bool)

Table Of Contents

Previous topic

PyCTOH source tree

Next topic

Plone DAP Client Book

This Page