Skip to content

Commit

Permalink
Docstanya (#291)
Browse files Browse the repository at this point in the history
* sphinx doctest in manual.rst

* chapter 1 continu

* add requirments.txt for read-the-doc

* move requirements.txt into docs dir

* add requirements

* Chapter 2

* add chapter 3

* finish chapter 3 started chapter 4

* flake8 python files

* chapter 4 regridding

* cdms_4 doctest

* add other chapters

* finish chapter 4

* add chapter 5

* add chapter 6

* cdms chapter 6

* fix TOC

* add chapter 7 and appendix

* merge docs

* add requirements.txt

* remove cdat_info

* remote cdat_info

* fix latex_logo png

* pin pyopenssl to 17.2.0 due to myproxyclient failure in py3

* update TOC

* work on tables and setup

* try to force jquery 3.1

* just copy js script in _static

* add highlight python

* add sample dataset page

* add sample dataset page

* work on tables for cdms_2.rst

* continue cdms2 documentations

* update cdms2 tables

* update sections

* update table

* finish chapter 2

* fix litteral error

* unlink .dodsrc for cdscan

* First changes from Tanya

* some change in chapter 1 and 2

* some changes in Chapter 2

* fix tables

* Some changes to Chapter 2

* Some Changes to Chapter 2

* Some changes made to Chapters 1, 2 and 4

* Some changes to Chapter 2

* Some Changes made to Chapter 2

* Some changes to Chapters 2, 3 and 4

* Some changes made to 1 through Appendix

* Some Changes made to Chapter 2

* Some Changes to Chapters 1, 2, 3, 6 and Appendix

* Some changes made to Chapters 1 thru 7 and appendix

* Some changes to Chpaters 1, 2 and 3

* Changes made to Chapters 1, 4, 5 and Appendix

* Some changes to Chapter 2 and 4

* Some Changes to Images, Chapter 3 and Appendix

* update logo

* add my logo

* fix chapter 1 test

* Some changes made to Chapters 2, 3 and 5

* Some Changes to Chapters 1 and 2

* Some changes to Appendix

* update banner/footer and version

* Some Changes to Chapters 1, 2, 3 and appendix

* change u to uold in example

* Some changes to Chapters 2, 4, 5 and 6

* Some changes to Regrid 2, Lib, esmf, gsRegrid and horizontal

* Changes made to Chapters 1-7 and sample data

* fix API documentation

* rename regrid2 directory and delete print message

* add module API files

* add future and mock requirements

* get cwd for readthedocs

* Changes made to API

* Changes made to API

* Changes made to API

* Changes to API

* test rtd with mock

* add future for readthedocs

* create git.py in ../..

* add esmf

* add print statements for regrid2

* add print for libregrid2

* restore regrid2.Lib for readthedocs

* add mock modules

* add git.py

* try with new mock list

* force git.py

* force git.py

* try readthedocs.yml file

* fix readthedocs maping file

* change type pdb to pdf

* typo requirements.yml

* add dependencies

* add dependencies and change conf.yml

* change API.rst and other rst files

* Changes to API

* UVCDAT_ANONYMOUS_LOG set to false

* check if git.py is there

* add gcc to environment.yml

* try docker environment.yml

* remove git.py

* chage Libregrid to regrid2

* revert

* revert

* add cdms2 class

* delet cdms2 class

* delet cdms2 class

* change conf.py os.path

* Changes to API

* Changes made to API

* Changes to API

* Changes made to API

* Changes to API

* Changes made to API

* Changes made to API

* Changes to API

* Changes to API

* Changes made to API

* Changes made to API

* Changes made to API

* push latest rst files

* Changes made to API

* Made some changes to API

* update documentations

* Changes made to API

* Changes made to API

* Changes made to API

* Changes made to Section 2 and API

* Changes made to Section 2

* Changes made to Chapter 2

* Changes made to Section 2

* Changes made to Chapters 2, 3, 4,5 and 6

* Changes made to Sections 2, 4, 7 and Appendix

* Changes made to Chapter 6 and Appendix

* Changes made to Section 2

* update summary table for API

* add generated files

* Changes made to al sections

* Changes made to Section 2 and API

* Changes made to 2 and API

* Made changes to sections 1 and 2

* Issue#231 (#232)

* fix #225 passing transiant variable as axis

* Fix macOSX

* fix ESMF and NPY_STRING

* fix data._mask comparison for numpy 1.14

* failing test from vcs added here (#234)

* failing test from vcs added here

* ok test passes again

* reverted for now

* commented out test for @durack1

* Cdmsdocsmerge (#223)

* First cdms2 documentation revamp

* latest changes

* add new files and work on avariable documentations

* fix index order

* revamp documentation

* Fixing cdms documentation (docstrings)

* update documentation

* continue to work on docs

* sphinx doctest in manual.rst

* chapter 1 continu

* add requirments.txt for read-the-doc

* move requirements.txt into docs dir

* add requirements

* Chapter 2

* add chapter 3

* finish chapter 3 started chapter 4

* flake8 python files

* chapter 4 regridding

* cdms_4 doctest

* add other chapters

* finish chapter 4

* add chapter 5

* add chapter 6

* cdms chapter 6

* fix TOC

* add chapter 7 and appendix

* merge docs

* add requirements.txt

* remove cdat_info

* remote cdat_info

* fix latex_logo png

* pin pyopenssl to 17.2.0 due to myproxyclient failure in py3

* update TOC

* work on tables and setup

* try to force jquery 3.1

* just copy js script in _static

* add highlight python

* add sample dataset page

* add sample dataset page

* work on tables for cdms_2.rst

* continue cdms2 documentations

* update cdms2 tables

* update sections

* update table

* finish chapter 2

* fix litteral error

* unlink .dodsrc for cdscan

* First changes from Tanya

* some change in chapter 1 and 2

* some changes in Chapter 2

* fix tables

* Some changes to Chapter 2

* Some Changes to Chapter 2

* Some changes made to Chapters 1, 2 and 4

* Some changes to Chapter 2

* Some Changes made to Chapter 2

* Some changes to Chapters 2, 3 and 4

* Some changes made to 1 through Appendix

* Some Changes made to Chapter 2

* Some Changes to Chapters 1, 2, 3, 6 and Appendix

* Some changes made to Chapters 1 thru 7 and appendix

* Some changes to Chpaters 1, 2 and 3

* Changes made to Chapters 1, 4, 5 and Appendix

* Some changes to Chapter 2 and 4

* Some Changes to Images, Chapter 3 and Appendix

* update logo

* add my logo

* fix chapter 1 test

* Fix python3 slice issue(setitem) and flake8 (#243)

* fix python 3 aggregation issue and flake8 (#244)

* Fix python3 slice issue(setitem) and flake8

* update to libnetcdf 4.6

* Netcdf46 (#249)

* Fix python3 slice issue(setitem) and flake8

* update to libnetcdf 4.6

* try circleci unstable label

* try version 2 circleci

* try version 2 circleci

* change workflow name

* change cdtime to cdms

* add certificate to circleci

* add fix conda-upload in circleci 2.0

* update prep_for_build version

* fix curl command

* fix cicleci for cdms

* use unstable channel change uvcdat for cdat

* build cdms on circleci 2.0

* fix circleci config.yml

* change Users/distiler to /Users/denisnadeau

* add gcc_linux

* add LDSHARED for linux

* disable cert and py results

* add gcc_linux-64

* change cdscan link

* fix myproxy

* add esmf and esmpy to py3 env

* Revert "Netcdf46 (#249)" (#250)

This reverts commit a9e29ea.

* Netcdf46 (#251)

* Fix python3 slice issue(setitem) and flake8

* update to libnetcdf 4.6

* try circleci unstable label

* try version 2 circleci

* try version 2 circleci

* change workflow name

* change cdtime to cdms

* add certificate to circleci

* add fix conda-upload in circleci 2.0

* update prep_for_build version

* fix curl command

* fix cicleci for cdms

* use unstable channel change uvcdat for cdat

* build cdms on circleci 2.0

* fix circleci config.yml

* change Users/distiler to /Users/denisnadeau

* add gcc_linux

* add LDSHARED for linux

* disable cert and py results

* add gcc_linux-64

* change cdscan link

* fix myproxy

* add esmf and esmpy to py3 env

* inverse dodsrc and curl commands

* move unlink above cdscan test

* fix ESGF test

* add new dodsrc files

* create dodsrc on-demand

* put back tests for unstable

* Netcdf46 (#252)

* Fix python3 slice issue(setitem) and flake8

* update to libnetcdf 4.6

* try circleci unstable label

* try version 2 circleci

* try version 2 circleci

* change workflow name

* change cdtime to cdms

* add certificate to circleci

* add fix conda-upload in circleci 2.0

* update prep_for_build version

* fix curl command

* fix cicleci for cdms

* use unstable channel change uvcdat for cdat

* build cdms on circleci 2.0

* fix circleci config.yml

* change Users/distiler to /Users/denisnadeau

* add gcc_linux

* add LDSHARED for linux

* disable cert and py results

* add gcc_linux-64

* change cdscan link

* fix myproxy

* add esmf and esmpy to py3 env

* inverse dodsrc and curl commands

* move unlink above cdscan test

* fix ESGF test

* add new dodsrc files

* create dodsrc on-demand

* put back tests for unstable

* instal anaconda-client before calling conda-upload

* Changes made to API

* Made some changes to API

* Changes made to API

* Changes made to API

* Changes made to API

* Changes made to Section 2 and API

* Changes made to Section 2

* Changes made to Chapter 2

* Changes made to Section 2

* Changes made to Chapters 2, 3, 4,5 and 6

* Changes made to Sections 2, 4, 7 and Appendix

* Changes made to Chapter 6 and Appendix

* Changes made to Section 2

* Changes made to al sections

* Changes made to Section 2 and API

* Changes made to 2 and API

* Made changes to sections 1 and 2

* Issue#231 (#232)

* fix #225 passing transiant variable as axis

* Fix macOSX

* fix ESMF and NPY_STRING

* fix data._mask comparison for numpy 1.14

* Fix python3 slice issue(setitem) and flake8 (#243)

* fix python 3 aggregation issue and flake8 (#244)

* Fix python3 slice issue(setitem) and flake8

* update to libnetcdf 4.6

* Netcdf46 (#249)

* Fix python3 slice issue(setitem) and flake8

* update to libnetcdf 4.6

* try circleci unstable label

* try version 2 circleci

* try version 2 circleci

* change workflow name

* change cdtime to cdms

* add certificate to circleci

* add fix conda-upload in circleci 2.0

* update prep_for_build version

* fix curl command

* fix cicleci for cdms

* use unstable channel change uvcdat for cdat

* build cdms on circleci 2.0

* fix circleci config.yml

* change Users/distiler to /Users/denisnadeau

* add gcc_linux

* add LDSHARED for linux

* disable cert and py results

* add gcc_linux-64

* change cdscan link

* fix myproxy

* add esmf and esmpy to py3 env

* Revert "Netcdf46 (#249)" (#250)

This reverts commit a9e29ea.

* Netcdf46 (#251)

* Fix python3 slice issue(setitem) and flake8

* update to libnetcdf 4.6

* try circleci unstable label

* try version 2 circleci

* try version 2 circleci

* change workflow name

* change cdtime to cdms

* add certificate to circleci

* add fix conda-upload in circleci 2.0

* update prep_for_build version

* fix curl command

* fix cicleci for cdms

* use unstable channel change uvcdat for cdat

* build cdms on circleci 2.0

* fix circleci config.yml

* change Users/distiler to /Users/denisnadeau

* add gcc_linux

* add LDSHARED for linux

* disable cert and py results

* add gcc_linux-64

* change cdscan link

* fix myproxy

* add esmf and esmpy to py3 env

* inverse dodsrc and curl commands

* move unlink above cdscan test

* fix ESGF test

* add new dodsrc files

* create dodsrc on-demand

* put back tests for unstable

* Netcdf46 (#252)

* Fix python3 slice issue(setitem) and flake8

* update to libnetcdf 4.6

* try circleci unstable label

* try version 2 circleci

* try version 2 circleci

* change workflow name

* change cdtime to cdms

* add certificate to circleci

* add fix conda-upload in circleci 2.0

* update prep_for_build version

* fix curl command

* fix cicleci for cdms

* use unstable channel change uvcdat for cdat

* build cdms on circleci 2.0

* fix circleci config.yml

* change Users/distiler to /Users/denisnadeau

* add gcc_linux

* add LDSHARED for linux

* disable cert and py results

* add gcc_linux-64

* change cdscan link

* fix myproxy

* add esmf and esmpy to py3 env

* inverse dodsrc and curl commands

* move unlink above cdscan test

* fix ESGF test

* add new dodsrc files

* create dodsrc on-demand

* put back tests for unstable

* instal anaconda-client before calling conda-upload

* Fix table titles

* Change made to Section 4

* fix bindex issue in hgrid

* Changes to all

* Corrections made to API Lib

* Changes to API

* fix ascii art

* Changes to Sections 2, 4 and 5

* Changes made to all

* Changes made to Sections 2, 6 and Appendix

* Changes made to Section 2

* Changes made to Section 2

* Changes made to Section 2 and 5

* Changes to Sections 2, 6 and 7

* Changes to API

* Changes made to API

* Made Changes to API

* Changes made to API

* Changes made to Section 4 and 7

* Changes made to API

* Changes made to API

* Revisit run tests (#262)

* migrate run_tests.py to use TestRunnerBase

* remove accidentally added tests/coverage.json

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* revisit run_tests.py

* add cacert.pem in run_tests.py when running cdms test within the lab

* add cacert.pem in run_tests.py when running cdms test within the lab

* add cacert.pem in run_tests.py when running cdms test within the lab

* add cacert.pem in run_tests.py when running cdms test within the lab - rerun tests

* add cacert.pem in run_tests.py when running cdms test within the lab - remove install from -c cdat/label/unstable

* put back -c cdat/label/unstable

* fix Axis.py

* update documentation

* fix environment dependencies

* add/remote generated files

* try to fix API.rst

* add regrid2 to docs

* Changes made to API

* fix space with parameters

* fix readthedocs using numpydoc

* update environment

* fix some autodocs

* add hgrid

* Changes made to API

* Changes made to API

* fix avariable bad location methods

* Changes to Appendix and API

* Changes to Chapter 1 and 2

* Changes made to Section 2

* Changes made to Section 2

* Changes made to Section 2

* Changes to sections 1, 2, 3 and 4

* Changes to section 2

* Changes made to entire docuemnt

* Changes to Section 1 and 2

* Changes made to Section 2

* Changes made to Sections 2 thru 6

* Changes made to Chapters 3 and 6

* add jupyter notebook

* Changes to all

* Changes to Jupyter Notebooks

* Changes to all

* update documentation for version 3.1.0

* merge documentations
  • Loading branch information
dnadeau4 committed Nov 9, 2018
1 parent 0c25c93 commit deaab8b
Show file tree
Hide file tree
Showing 1,406 changed files with 22,715 additions and 2,639 deletions.
54 changes: 35 additions & 19 deletions Lib/MV2.py
Expand Up @@ -109,11 +109,13 @@ def __call__(self, a, axis=0, **kwargs):

def commonDomain(a, b, omit=None):
"""commonDomain(a,b) tests that the domains of variables/arrays a and b are equal,
and returns the common domain if equal, or None if not equal. The domains may
differ in that one domain may have leading axes not common
to the other; the result domain will contain those axes.
If <omit> is specified, as an integer i, skip comparison of the ith dimension
and return None for the ith (common) dimension.
and returns the common domain if equal, or None if not equal.
The domains may differ in that one domain may have leading axes not common
to the other; the result domain will contain those axes.
If <omit> is specified, as an integer i, skip comparison of the ith dimension
and return None for the ith (common) dimension.
"""

if isinstance(b, AbstractVariable):
Expand Down Expand Up @@ -183,11 +185,11 @@ def commonGrid(a, b, axes):
and consistent with the list of axes. If so, the common grid is returned, else None
is returned. a and b can be numpy arrays, in which case the result is None.
The common grid is 'consistent' with axes if the grid axes (e.g., the axes of latitude and
longitude coordinate variables) are members of the list 'axes'.
The common grid is 'consistent' with axes if the grid axes (e.g., the axes of
latitude and longitude coordinate variables) are members of the list 'axes'.
If the grid(s) of a, b are rectilinear, the result is None, as the grids are implicitly
defined by the axes.
If the grid(s) of a, b are rectilinear, the result is None, as the grids
are implicitly defined by the axes.
"""
if isinstance(b, AbstractVariable):
gb = b.getGrid()
Expand Down Expand Up @@ -556,12 +558,15 @@ def sort(a, axis=-1):


def choose(myindices, t):
"""Returns an array shaped like indices containing elements chosen
from t.
If an element of t is the special element masked, any element
of the result that "chooses" that element is masked.
"""
The result has only the default axes.
Returns
-------
an array shaped like indices containing elements chosen from t.
If an element of t is the special element masked, any element of
the result that "chooses" that element is masked. The result has
only the default axes.
"""
maresult = numpy.ma.choose(myindices, list(map(_makeMaskedArg, t)))
F = getattr(t, "fill_value", 1.e20)
Expand All @@ -580,8 +585,12 @@ def where(condition, x, y):


def masked_where(condition, x, copy=1):
"""Return x as an array masked where condition is true.
Also masked where x or condition masked.
"""
Returns
-------
x as an array masked where condition is true. Also masked where x or condition masked.
"""
tx = _makeMaskedArg(x)
tcondition = _makeMaskedArg(condition)
Expand Down Expand Up @@ -766,6 +775,7 @@ def transpose(a, axes=None):


class _minimum_operation:

"Object to calculate minima"

def __init__(self):
Expand Down Expand Up @@ -886,8 +896,13 @@ def outer(self, a, b):

def asarray(data, typecode=None, dtype=None):
"""asarray(data, typecode=None, dtype=None) is equivalent to array(data, dtype=None, copy=0)
Returns data if dtype is None or data is a MaskedArray of the same dtype.
typecode arg is for backward compatibility.
Returns
-------
data if dtype is None or data is a MaskedArray of the same dtype.
typecode arg is for backward compatibility.
"""
dtype = _convdtype(dtype, typecode)
if isinstance(data, AbstractVariable) and (
Expand Down Expand Up @@ -939,7 +954,8 @@ def ones(myshape, typecode=float, savespace=0, axes=None,


def outerproduct(a, b):
"""outerproduct(a,b) = {a[i]*b[j]}, has shape (len(a),len(b))"""
"""outerproduct(a,b) = {a[i]*b[j]}, has shape (len(a),len(b))
"""
ta = asVariable(a, writeable=1)
tb = asVariable(b, writeable=1)
maresult = numpy.ma.outerproduct(ta, tb)
Expand Down
115 changes: 71 additions & 44 deletions Lib/avariable.py
Expand Up @@ -36,17 +36,24 @@

def getMinHorizontalMask(var):
"""
Get the minimum mask associated with 'x' and 'y' (i.e. with the
min number of ones) across all axes
Get the minimum mask associated with 'x' and 'y'
(i.e. with the min number of ones) across all axes
Parameters
----------
var
CDMS variable with a mask
Return
------
mask array or None if order 'x' and 'y' were not found
var :
CDMS variable with a mask
N/A :
None
Returns
-------
mask array or None :
if order 'x' and 'y' were not found
"""
from distarray import MultiArrayIter

Expand Down Expand Up @@ -127,14 +134,21 @@ def getNumericCompatibility():


class AbstractVariable(CdmsObj, Slab):
"""Not to be called by users.
Parameters
----------
variableNode
is the variable tree node, if any.
parent
is the containing dataset instance.
"""

def info(self, flag=None, device=None):
Slab.info(self, flag, device)

def __init__(self, parent=None, variableNode=None):
"""Not to be called by users.
variableNode is the variable tree node, if any.
parent is the containing dataset instance.
"""

if variableNode is not None and variableNode.tag != 'variable':
raise CDMSError('Node is not a variable node')
CdmsObj.__init__(self, variableNode)
Expand Down Expand Up @@ -163,20 +177,20 @@ def __call__(self, *args, **kwargs):
"""
Selection of a subregion using selectors.
Parameters
----------
raw:
if set to 1, return numpy.ma only
squeeze:
if set to 1, eliminate any dimension of length 1
grid:
if given, result is regridded ont this grid.
order:
if given, result is permuted into this order
**Parameters:**
Returns
-------
Subregion selected
raw:
if set to 1, return numpy.ma only
squeeze:
if set to 1, eliminate any dimension of length 1
grid:
if given, result is regridded ont this grid.
order:
if given, result is permuted into this order
**Returns:**
Subregion selected
"""
# separate options from selector specs
d = kwargs.copy()
Expand Down Expand Up @@ -468,6 +482,10 @@ def getAxisListIndex(self, axes=None, omit=None, order=None):
If axes is `None`, use all axes of this variable.
Other specificiations are as for axisMatchIndex.
Returns
-------
a list of indices of axis objects;
"""
return axisMatchIndex(self.getAxisList(), axes, omit, order)

Expand Down Expand Up @@ -521,7 +539,8 @@ def getMissing(self, asarray=0):

if asarray == 0 and isinstance(mv, numpy.ndarray):
mv = mv[0]
if isinstance(mv, string_types) and self.dtype.char not in ['?', 'c', 'O', 'S']:
if isinstance(mv, string_types) and self.dtype.char not in [
'?', 'c', 'O', 'S']:
try:
mv = float(mv)
except BaseException:
Expand Down Expand Up @@ -1426,7 +1445,8 @@ def _process_specs(self, specs, keys):
nsupplied = len(specs)
# numpy will broadcast if we have a new axis in specs
# ---------------------------------------------------
if [x for x in specs if numpy.array_equal(x, numpy.newaxis)] == [numpy.newaxis]:
if [x for x in specs if numpy.array_equal(x, numpy.newaxis)] == [
numpy.newaxis]:
nnewaxis = 1
else:
nnewaxis = 0
Expand Down Expand Up @@ -1713,8 +1733,13 @@ def __getitem__(self, key):
raise IndexError("Index too large: %d" % key)
speclist = self._process_specs([key], {})

if [x for x in speclist if (type(x) is numpy.ndarray or type(x) is list)] != []:
index = [x for x in speclist if (type(x) is numpy.ndarray or type(x) is list)]
if [x for x in speclist if (isinstance(
x, numpy.ndarray) or isinstance(x, list))] != []:
index = [
x for x in speclist if (
isinstance(
x, numpy.ndarray) or isinstance(
x, list))]
return self.data.take(index)
# Note: raw=0 ensures that a TransientVariable is returned
return self.getSlice(numericSqueeze=1, raw=0, isitem=1, *speclist)
Expand Down Expand Up @@ -1823,14 +1848,15 @@ 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
* The letter - meaning insert the next available axis here.
* The ellipsis ... meaning fill these positions with any remaining axes.
* (name) meaning an axis whose id is name
Note:
Order elements can be:
* Letters t, x, y, z meaning time, longitude, latitude, level
* Numbers 0-9 representing position in axes
* The letter - meaning insert the next available axis here.
* The ellipsis ... meaning fill these positions with any remaining axes.
* (name) meaning an axis whose id is name
"""
if not isinstance(order, string_types):
raise CDMSError('order arguments must be strings.')
Expand Down Expand Up @@ -1861,14 +1887,15 @@ def orderparse(order):
def order2index(axes, order):
"""Find the index permutation of axes to match 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
* The letter - meaning insert the next available axis here.
* The ellipsis ... meaning fill these positions with any remaining axes.
* (name) meaning an axis whose id is name.
Note:
Order elements can be:
* Letters t, x, y, z meaning time, longitude, latitude, level.
* Numbers 0-9 representing position in axes
* The letter - meaning insert the next available axis here.
* The ellipsis ... meaning fill these positions with any remaining axes.
* (name) meaning an axis whose id is name.
"""
if isinstance(order, string_types):
result = orderparse(order)
Expand Down

0 comments on commit deaab8b

Please sign in to comment.