Skip to content

Commit

Permalink
merge documentations
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadeau4 committed Nov 9, 2018
1 parent 5216d3b commit b7a23ec
Show file tree
Hide file tree
Showing 21 changed files with 472 additions and 1,161 deletions.
16 changes: 8 additions & 8 deletions Lib/avariable.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@

def getMinHorizontalMask(var):
"""
Get the minimum mask associated with 'x' and 'y'
Get the minimum mask associated with 'x' and 'y'
(i.e. with the min number of ones) across all axes
Parameters
----------
var :
var :
CDMS variable with a mask
N/A :
N/A :
None
Returns
Expand Down Expand Up @@ -178,7 +178,7 @@ def __call__(self, *args, **kwargs):
Selection of a subregion using selectors.
**Parameters:**
raw:
if set to 1, return numpy.ma only
squeeze:
Expand All @@ -189,7 +189,7 @@ def __call__(self, *args, **kwargs):
if given, result is permuted into this order
**Returns:**
Subregion selected
"""
# separate options from selector specs
Expand Down Expand Up @@ -1848,9 +1848,9 @@ def astype(self, tc):

def orderparse(order):
"""Parse an order string. Returns a list of axes specifiers.
Note:
Order elements can be:
* Letters t, x, y, z meaning time, longitude, latitude, level
* Numbers 0-9 representing position in axes
Expand Down Expand Up @@ -1889,7 +1889,7 @@ def order2index(axes, order):
The argument order is a string.
Note:
Order elements can be:
* Letters t, x, y, z meaning time, longitude, latitude, level.
* Numbers 0-9 representing position in axes
Expand Down
81 changes: 33 additions & 48 deletions Lib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from future import standard_library
import sys
import os
import types
import copy
import numpy
Expand All @@ -26,34 +25,22 @@
_debug = 0
std_axis_attributes = ['name', 'units', 'length', 'values', 'bounds']

ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'

if not ON_RTD:
class AliasList (UserList):
def __init__(self, alist):
UserList.__init__(self, alist)
class AliasList (UserList):
def __init__(self, alist):
UserList.__init__(self, alist)

def __setitem__(self, i, value):
self.data[i] = value.lower()
def __setitem__(self, i, value):
self.data[i] = value.lower()

def __setslice(self, i, j, values):
self.data[i:j] = [x.lower() for x in values]
def __setslice(self, i, j, values):
self.data[i:j] = [x.lower() for x in values]

def append(self, value):
self.data.append(value.lower())
def append(self, value):
self.data.append(value.lower())

def extend(self, values):
self.data.extend(list(map(str.lower, values)))
else:
class MockObject(object):
def __init__(self, *args, **kwargs):
super(MockObject, self).__init__()

def __call__(self, *args, **kwargs):
return None

class AliasList(MockObject):
pass
def extend(self, values):
self.data.extend(list(map(str.lower, values)))


level_aliases = AliasList(['plev'])
Expand Down Expand Up @@ -1265,9 +1252,7 @@ def mapInterval(self, interval, indicator='ccn', cycle=None):
same meaning for the right-hand point. Set cycle to a nonzero value
to force wraparound.
Returns
-------
The corresponding index interval (i,j), where i<j, indicating
Returns the corresponding index interval (i,j), where i<j, indicating
the half-open index interval [i,j), or None if the intersection is empty.
For an axis which is circular (self.topology == 'circular'), [i,j)
Expand Down Expand Up @@ -2622,34 +2607,34 @@ def axisMatchIndex(axes, specifications=None, omit=None, order=None):

def axisMatches(axis, specification):
"""
Parameters
----------
axis:
See note below
specifications:
See note below
Parameters
----------
axis:
See note below
specifications:
See note below
Returns
-------
1 or 0 depending on whether axis matches the specification.
Returns
-------
1 or 0 depending on whether axis matches the specification.
Note
----
Specification must be one of:
Note
----
Specification must be one of:
#. a string representing an axis id or one of the keywords time,
fctau0, latitude or lat, longitude or lon, or lev or level.
#. a string representing an axis id or one of the keywords time,
fctau0, latitude or lat, longitude or lon, or lev or level.
#. Axis may be surrounded with parentheses or spaces.
#. Axis may be surrounded with parentheses or spaces.
* We first attempt to match the axis id and the specification.
* Keywords try to match using isTime, isLatitude, etc.
* Comparisons to keywords and axis ids is case-insensitive.
* We first attempt to match the axis id and the specification.
* Keywords try to match using isTime, isLatitude, etc.
* Comparisons to keywords and axis ids is case-insensitive.
#. a function that takes an axis as an argument and returns a value.
* if the value returned is true, the axis matches.
#. a function that takes an axis as an argument and returns a value.
* if the value returned is true, the axis matches.
#. an axis object; will match if it is the same object as axis.
#. an axis object; will match if it is the same object as axis.
"""
if isinstance(specification, string_types):
s = specification.lower()
Expand Down
3 changes: 1 addition & 2 deletions Lib/bindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

"""Bin index for non-rectilinear grids"""

# from . import _bindex
import _bindex
from . import _bindex
import numpy


Expand Down
8 changes: 4 additions & 4 deletions Lib/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def lock(filename):
Note: This function is UNIX-specific.
Note: It is important to delete the lock via unlock() if the process is
interrupted, otherwise subsequent locks will fail.
interrupted, otherwise subsequent locks will fail.
"""

path = lockpath(filename)
Expand Down Expand Up @@ -302,7 +302,7 @@ def get(self, filekey):
Parameters
----------
<filekey>
filekey for cache
filekey for cache
"""
filekey = str(filekey)
lock("index_lock")
Expand All @@ -325,7 +325,7 @@ def put(self, filekey, path):
Parameters
----------
<filekey>
filekey for cache
filekey for cache
"""

filekey = str(filekey)
Expand Down Expand Up @@ -353,7 +353,7 @@ def deleteEntry(self, filekey):
Parameters
----------
<filekey>
filekey for cache
filekey for cache
"""
filekey = str(filekey)

Expand Down
37 changes: 11 additions & 26 deletions Lib/convention.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" metadata conventions """

from __future__ import print_function
import os
from .error import CDMSError
from collections import UserList

Expand All @@ -9,34 +9,19 @@

MethodNotImplemented = "Method not yet implemented"

ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'

if not ON_RTD:
class AliasList (UserList):
def __init__(self, alist):
UserList.__init__(self, alist)

def __setitem__(self, i, value):
self.data[i] = value.lower()

def __setslice(self, i, j, values):
self.data[i:j] = [x.lower() for x in values]

def append(self, value):
self.data.append(value.lower())
class AliasList (UserList):
def __init__(self, alist):
UserList.__init__(self, alist)

def extend(self, values):
self.data.extend(list(map(str.lower, values)))
else:
class MockObject(object):
def __init__(self, *args, **kwargs):
super(MockObject, self).__init__()
def __setitem__(self, i, value):
self.data[i] = value.lower()

def __call__(self, *args, **kwargs):
return None
def __setslice(self, i, j, values):
self.data[i:j] = [x.lower() for x in values]

class AliasList(MockObject):
pass
def append(self, value):
self.data.append(value.lower())


level_aliases = AliasList(['plev'])
Expand Down Expand Up @@ -242,7 +227,7 @@ def axisIsLongitude(self, axis):
return AbstractConvention.axisIsLongitude(self, axis)

def getVariableBounds(self, dset, var):
"Get the bounds variable for the variable, from a dataset or file."
"""Get the bounds variable for the variable, from a dataset or file."""
if hasattr(var, 'bounds'):
boundsid = var.bounds
if boundsid in dset.variables:
Expand Down
9 changes: 3 additions & 6 deletions Lib/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
from __future__ import print_function
from .error import CDMSError
import sys
# from . import Cdunif
import Cdunif
from . import Cdunif
import numpy
# from . import cdmsNode
import cdmsNode
from . import cdmsNode
import os
import string
import urllib
from urllib.parse import urlparse, urlunparse
# from . import cdmsobj
import cdmsobj
from . import cdmsobj
import re
from .CDMLParser import CDMLParser
from .cdmsobj import CdmsObj
Expand Down
2 changes: 1 addition & 1 deletion Lib/fvariable.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .variable import DatasetVariable
from .error import CDMSError
from .sliceut import reverseSlice
from cdms2.Cdunif import CdunifError
from .Cdunif import CdunifError
# import cdms2.Cdunif.CdunifError as CdunifError

FileClosed = "Cannot read from closed file, variable: "
Expand Down
2 changes: 1 addition & 1 deletion Lib/gengrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def reconcile(self, axes):
for i in missing:
for item in axes:
if (len(selfaxes[i]) == len(item)) and \
allclose(selfaxes[i], item):
allclose(selfaxes[i], item):
result._lataxis_.setAxis(i, item)
result._lonaxis_.setAxis(i, item)
break
Expand Down
5 changes: 2 additions & 3 deletions Lib/hgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def _flatten(boundsar):

class AbstractHorizontalGrid(AbstractGrid):
""" Create an horizontal grid
Parameters
----------
latAxis
latAxis
lonAxis
id - Default None
maskvar - Default None
Expand Down Expand Up @@ -908,7 +908,6 @@ class TransientCurveGrid(AbstractCurveGrid):
Not documented
"""


grid_count = 0

def __init__(self, latAxis, lonAxis, id=None, maskvar=None, tempmask=None):
Expand Down
Loading

0 comments on commit b7a23ec

Please sign in to comment.