├── MANIFEST.in ├── docs ├── _build │ ├── html │ │ ├── objects.inv │ │ ├── _static │ │ │ ├── down.png │ │ │ ├── file.png │ │ │ ├── plus.png │ │ │ ├── up.png │ │ │ ├── minus.png │ │ │ ├── comment.png │ │ │ ├── ajax-loader.gif │ │ │ ├── up-pressed.png │ │ │ ├── comment-bright.png │ │ │ ├── comment-close.png │ │ │ ├── down-pressed.png │ │ │ ├── pygments.css │ │ │ ├── default.css │ │ │ ├── sidebar.js │ │ │ ├── doctools.js │ │ │ ├── basic.css │ │ │ └── searchtools.js │ │ ├── .buildinfo │ │ ├── _sources │ │ │ ├── index.txt │ │ │ ├── introduction.txt │ │ │ └── spacegrids.txt │ │ ├── search.html │ │ ├── _modules │ │ │ └── index.html │ │ ├── py-modindex.html │ │ ├── index.html │ │ ├── introduction.html │ │ └── searchindex.js │ └── doctrees │ │ ├── index.doctree │ │ ├── environment.pickle │ │ ├── spacegrids.doctree │ │ └── introduction.doctree ├── index.rst~ ├── index.rst ├── introduction.rst ├── introduction.rst~ ├── spacegrids.rst ├── make.bat ├── Makefile └── conf.py ├── spacegrids ├── __init__.py ├── decorators.py ├── _config.py ├── _iosg.py ├── ops.py ├── plotting.py └── expercls.py ├── .travis.yml ├── setup.py ├── LICENSE ├── README └── README.rst /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.rst 2 | -------------------------------------------------------------------------------- /docs/_build/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/objects.inv -------------------------------------------------------------------------------- /docs/_build/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/down.png -------------------------------------------------------------------------------- /docs/_build/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/file.png -------------------------------------------------------------------------------- /docs/_build/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/plus.png -------------------------------------------------------------------------------- /docs/_build/html/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/up.png -------------------------------------------------------------------------------- /docs/_build/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/doctrees/index.doctree -------------------------------------------------------------------------------- /docs/_build/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/minus.png -------------------------------------------------------------------------------- /docs/_build/html/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/comment.png -------------------------------------------------------------------------------- /docs/_build/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/doctrees/environment.pickle -------------------------------------------------------------------------------- /docs/_build/doctrees/spacegrids.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/doctrees/spacegrids.doctree -------------------------------------------------------------------------------- /docs/_build/html/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/ajax-loader.gif -------------------------------------------------------------------------------- /docs/_build/html/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/up-pressed.png -------------------------------------------------------------------------------- /docs/_build/doctrees/introduction.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/doctrees/introduction.doctree -------------------------------------------------------------------------------- /docs/_build/html/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/comment-bright.png -------------------------------------------------------------------------------- /docs/_build/html/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/comment-close.png -------------------------------------------------------------------------------- /docs/_build/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsijp/spacegrids/HEAD/docs/_build/html/_static/down-pressed.png -------------------------------------------------------------------------------- /docs/_build/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 4d67e21fd944996524a9a02fc285c101 4 | tags: fbb0d17656682115ca4d033fb2f83ba1 5 | -------------------------------------------------------------------------------- /docs/index.rst~: -------------------------------------------------------------------------------- 1 | .. spacegrids documentation master file, created by 2 | sphinx-quickstart on Wed Aug 6 13:45:41 2014. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Spacegrids data analysis documentation 7 | ====================================== 8 | 9 | 10 | 11 | Contents: 12 | -------- 13 | 14 | .. toctree:: 15 | :maxdepth: 4 16 | 17 | spacegrids 18 | 19 | 20 | Indices and tables 21 | ================== 22 | 23 | * :ref:`genindex` 24 | * :ref:`modindex` 25 | * :ref:`search` 26 | 27 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. spacegrids documentation master file, created by 2 | sphinx-quickstart on Wed Aug 6 13:45:41 2014. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Spacegrids data analysis documentation 7 | ====================================== 8 | 9 | 10 | 11 | Contents: 12 | -------- 13 | 14 | .. toctree:: 15 | 16 | .. toctree:: 17 | :maxdepth: 2 18 | 19 | introduction.rst 20 | 21 | .. toctree:: 22 | :maxdepth: 4 23 | 24 | spacegrids 25 | 26 | 27 | Indices and tables 28 | ================== 29 | 30 | * :ref:`genindex` 31 | * :ref:`modindex` 32 | * :ref:`search` 33 | 34 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/index.txt: -------------------------------------------------------------------------------- 1 | .. spacegrids documentation master file, created by 2 | sphinx-quickstart on Wed Aug 6 13:45:41 2014. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Spacegrids data analysis documentation 7 | ====================================== 8 | 9 | 10 | 11 | Contents: 12 | -------- 13 | 14 | .. toctree:: 15 | 16 | .. toctree:: 17 | :maxdepth: 2 18 | 19 | introduction.rst 20 | 21 | .. toctree:: 22 | :maxdepth: 4 23 | 24 | spacegrids 25 | 26 | 27 | Indices and tables 28 | ================== 29 | 30 | * :ref:`genindex` 31 | * :ref:`modindex` 32 | * :ref:`search` 33 | 34 | -------------------------------------------------------------------------------- /spacegrids/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | """ 3 | 4 | import os 5 | import numpy as np 6 | 7 | 8 | from fieldcls import * 9 | from expercls import * 10 | from projectcls import * 11 | from ops import * 12 | from plotting import * 13 | from _config import * 14 | from _iosg import * 15 | from utilsg import * 16 | 17 | # masked arrays are done as follows: 18 | # S=[1.,2.,3.,np.nan,5.] 19 | # R=ma.masked_array(S,np.isnan(S)) 20 | # ma.sum(R) 21 | 22 | # Land is usually nan in fields. To obtain a field from F where land is nan as in F, but the rest is 1, divide F by itself: F/F. 23 | # If F is on grid yt*xt, say, and dA=dy*dx is a field containing the surface areas of the grid cells (dx = xt.d(yt), dy = yt.d()), then dA*(F/F) yields the surface area of the ocean area (or the non-nan area). 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/introduction.rst: -------------------------------------------------------------------------------- 1 | 2 | 3 | .. include:: ../README.rst 4 | 5 | Other Packages 6 | -------------- 7 | 8 | A related promising package is `dimarray`_. It considers dimension names as a fundamental property of an array, and as such supports netCDF I/O format. It makes use of it in binary operations (broadcasting), transforms and indexing. 9 | It includes some of the nice features of pandas (e.g. axis alignment, optional 10 | nan skipping) but extends them to N dimensions, with a behaviour closer 11 | to a numpy array. Some geo features are planned (weighted mean for latitude, 12 | indexing modulo 360 for longitude, basic regridding) but dimarray should remain broad in scope. Other packages are `larry`_ , `pandas`_ and `iris`_. 13 | 14 | 15 | 16 | 17 | .. _larry: http://berkeleyanalytics.com/la 18 | .. _pandas: http://pandas.pydata.org 19 | .. _iris: http://scitools.org.uk/iris 20 | .. _dimarray: dimarray.readthedocs.org 21 | .. _spacegrids: https://github.com/willo12/spacegrids 22 | 23 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/introduction.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | .. include:: ../README.rst 4 | 5 | Other Packages 6 | -------------- 7 | 8 | A related promising package is `dimarray`_. It considers dimension names as a fundamental property of an array, and as such supports netCDF I/O format. It makes use of it in binary operations (broadcasting), transforms and indexing. 9 | It includes some of the nice features of pandas (e.g. axis alignment, optional 10 | nan skipping) but extends them to N dimensions, with a behaviour closer 11 | to a numpy array. Some geo features are planned (weighted mean for latitude, 12 | indexing modulo 360 for longitude, basic regridding) but dimarray should remain broad in scope. Other packages are `larry`_ , `pandas`_ and `iris`_. 13 | 14 | 15 | 16 | 17 | .. _larry: http://berkeleyanalytics.com/la 18 | .. _pandas: http://pandas.pydata.org 19 | .. _iris: http://scitools.org.uk/iris 20 | .. _dimarray: dimarray.readthedocs.org 21 | .. _spacegrids: https://github.com/willo12/spacegrids 22 | 23 | -------------------------------------------------------------------------------- /docs/introduction.rst~: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | .. include:: ../README.rst 5 | 6 | Other Packages 7 | -------------- 8 | 9 | A related promising package is `dimarray`_. It considers dimension names as a fundamental property of an array, and as such supports netCDF I/O format. It makes use of it in binary operations (broadcasting), transforms and indexing. 10 | It includes some of the nice features of pandas (e.g. axis alignment, optional 11 | nan skipping) but extends them to N dimensions, with a behaviour closer 12 | to a numpy array. Some geo features are planned (weighted mean for latitude, 13 | indexing modulo 360 for longitude, basic regridding) but dimarray should remain broad in scope. Other packages are `larry`_ , `pandas`_ and `iris`_. 14 | 15 | 16 | 17 | 18 | .. _larry: http://berkeleyanalytics.com/la 19 | .. _pandas: http://pandas.pydata.org 20 | .. _iris: http://scitools.org.uk/iris 21 | .. _dimarray: dimarray.readthedocs.org 22 | .. _spacegrids: https://github.com/willo12/spacegrids 23 | 24 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Configuration file for travis-ci.org 2 | # 3 | # Travis is a continuous integration service that connects to Github & 4 | # automatically runs tests when commits are made. To use this on your own 5 | # branches register at https://travis-ci.org & enable builds for your 6 | # spacegrids branch. 7 | # 8 | # If tests fail you will get an email message as well as a message on any pull 9 | # requests. 10 | 11 | language: python 12 | 13 | # Python versions to test 14 | python: 15 | - 2.7 16 | 17 | # Install anaconda for quicker dependency installs 18 | before_install: 19 | - wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh 20 | - bash miniconda.sh -b 21 | - export PATH=/home/travis/miniconda/bin:$PATH 22 | - conda update --yes conda 23 | 24 | # Install dependencies & test data 25 | install: 26 | - mkdir -p $HOME/PROJECTS/my_project 27 | - wget http://web.science.unsw.edu.au/~wsijp/code/examples.tar.gz -O - | tar xz -C $HOME/PROJECTS/my_project --strip-components=1 28 | - conda install --yes python=$TRAVIS_PYTHON_VERSION pip numpy scipy matplotlib 29 | - pip install . 30 | - pip freeze 31 | 32 | # Run tests 33 | script: 34 | - python tests/tests.py 35 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | #from distutils.core import setup 4 | from setuptools import setup, find_packages 5 | 6 | def read(fname): 7 | return open(os.path.join(os.path.dirname(__file__), fname )).read() 8 | 9 | #with open('README.rst') as file: 10 | # long_description = file.read() 11 | 12 | setup(name='spacegrids', 13 | version='1.9', 14 | author='Willem Sijp', 15 | author_email='wim.sijp@gmail.com', 16 | description='numpy array with grids and associated operations', 17 | download_url="https://github.com/willo12/spacegrids/tarball/1.8", 18 | keywords=('climate data','grid data','data on grids','spatial grids', 'Netcdf data analysis', 'climate analysis scripts',"interpreting meta data Netcdf","geophysics tools"), 19 | packages = find_packages(exclude="tests"), 20 | classifiers = [], 21 | # package_data = { 22 | # "spacegrids": ['README.rst'] 23 | # }, 24 | long_description=read('README.rst'), 25 | url='https://github.com/willo12/spacegrids', 26 | license = "BSD", 27 | # install_requires = ["numpy>=1.6","scipy>=0.10","matplotlib>=1.1"] 28 | install_requires = [] 29 | # extras_require = { 30 | # "ncio": ["netCDF4>=1.0.6"], 31 | # "pandas": ["pandas>=0.8.0"], 32 | # "plotting": ["pandas>=0.8.0","matplotlib>=1.2.1"], 33 | # "interp2d": ["basemap>=1.06"], 34 | # } 35 | ) 36 | -------------------------------------------------------------------------------- /docs/spacegrids.rst: -------------------------------------------------------------------------------- 1 | spacegrids Package 2 | ================== 3 | 4 | :mod:`spacegrids` Package 5 | ------------------------- 6 | 7 | .. automodule:: spacegrids.__init__ 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | 12 | 13 | :mod:`abstract` Module 14 | ---------------------- 15 | 16 | .. automodule:: spacegrids.abstract 17 | :members: 18 | :undoc-members: 19 | :show-inheritance: 20 | 21 | 22 | :mod:`expercls` Module 23 | ---------------------- 24 | 25 | .. automodule:: spacegrids.expercls 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | :mod:`fieldcls` Module 31 | ---------------------- 32 | 33 | .. automodule:: spacegrids.fieldcls 34 | :members: 35 | :undoc-members: 36 | :show-inheritance: 37 | 38 | :mod:`ops` Module 39 | ----------------- 40 | 41 | .. automodule:: spacegrids.ops 42 | :members: 43 | :undoc-members: 44 | :show-inheritance: 45 | 46 | :mod:`plotting` Module 47 | ---------------------- 48 | 49 | .. automodule:: spacegrids.plotting 50 | :members: 51 | :undoc-members: 52 | :show-inheritance: 53 | 54 | :mod:`projectcls` Module 55 | ------------------------ 56 | 57 | .. automodule:: spacegrids.projectcls 58 | :members: 59 | :undoc-members: 60 | :show-inheritance: 61 | 62 | :mod:`utilsg` Module 63 | -------------------- 64 | 65 | .. automodule:: spacegrids.utilsg 66 | :members: 67 | :undoc-members: 68 | :show-inheritance: 69 | 70 | -------------------------------------------------------------------------------- /spacegrids/decorators.py: -------------------------------------------------------------------------------- 1 | # ---- decorators ----- 2 | 3 | 4 | 5 | def check_equiv(func): 6 | """ 7 | Decorator to perform preliminary equivalence check between self and other. 8 | 9 | Args: 10 | func: function. 11 | 12 | Returns: 13 | Function: the decorator. 14 | """ 15 | 16 | def checker(caller,other, *args, **kwargs): 17 | 18 | 19 | if not(caller.is_equiv(other)): 20 | warnings.warn("Ordered equivalence wrong, aborting with None!") 21 | return 22 | 23 | return func(caller,other, *args, **kwargs) 24 | 25 | return checker 26 | 27 | 28 | 29 | 30 | def method2members(func): 31 | """ 32 | Decorator to transfer method call from Membered object to its members. 33 | 34 | Args: 35 | func: function. 36 | 37 | Returns: 38 | Function: the decorator. 39 | """ 40 | 41 | def wrap(caller, *args, **kwargs): 42 | 43 | method_name = func.__name__ 44 | 45 | return caller.call_on_members(method_name, *args, **kwargs) 46 | 47 | return wrap 48 | 49 | 50 | def att2members(func): 51 | """ 52 | Decorator to transfer attribute retrieval from Membered object to its members. 53 | 54 | Args: 55 | func: function. 56 | 57 | Returns: 58 | Function: the decorator. 59 | """ 60 | 61 | def wrap(caller, *args, **kwargs): 62 | 63 | att_name = func.__name__ 64 | 65 | return caller.get_from_members(att_name, *args, **kwargs) 66 | 67 | return wrap 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/spacegrids.txt: -------------------------------------------------------------------------------- 1 | spacegrids Package 2 | ================== 3 | 4 | :mod:`spacegrids` Package 5 | ------------------------- 6 | 7 | .. automodule:: spacegrids.__init__ 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | 12 | 13 | :mod:`abstract` Module 14 | ---------------------- 15 | 16 | .. automodule:: spacegrids.abstract 17 | :members: 18 | :undoc-members: 19 | :show-inheritance: 20 | 21 | 22 | :mod:`expercls` Module 23 | ---------------------- 24 | 25 | .. automodule:: spacegrids.expercls 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | :mod:`fieldcls` Module 31 | ---------------------- 32 | 33 | .. automodule:: spacegrids.fieldcls 34 | :members: 35 | :undoc-members: 36 | :show-inheritance: 37 | 38 | :mod:`ops` Module 39 | ----------------- 40 | 41 | .. automodule:: spacegrids.ops 42 | :members: 43 | :undoc-members: 44 | :show-inheritance: 45 | 46 | :mod:`plotting` Module 47 | ---------------------- 48 | 49 | .. automodule:: spacegrids.plotting 50 | :members: 51 | :undoc-members: 52 | :show-inheritance: 53 | 54 | :mod:`projectcls` Module 55 | ------------------------ 56 | 57 | .. automodule:: spacegrids.projectcls 58 | :members: 59 | :undoc-members: 60 | :show-inheritance: 61 | 62 | :mod:`utilsg` Module 63 | -------------------- 64 | 65 | .. automodule:: spacegrids.utilsg 66 | :members: 67 | :undoc-members: 68 | :show-inheritance: 69 | 70 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ======= 2 | License 3 | ======= 4 | 5 | spacegrids is distributed under a 3-clause ("Simplified" or "New") BSD license. 6 | 7 | spacegrids license 8 | ================ 9 | 10 | Copyright (c) 2014, Willem Sijp 11 | All rights reserved. 12 | 13 | spacegrids 14 | 15 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 18 | 19 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 20 | 21 | 3. Neither the name of the copyright holders nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Spacegrids 2 | ========== 3 | 4 | Spacegrids is an open source library providing a Numpy array with grids, labelled axes and associated grid-related mathematical methods such as regridding and integration. Spacegrids provides an object data model of Netcdf data that ensures consistency between a Numpy data array and its grid under common operations (and so avoiding common pitfalls related to axis interpretation), and much more. It is a write less do more library for everyday use. 5 | 6 | The Field, Gr (grid) and Coord objects make everyday use easy: 7 | 8 | >>> import spacegrids as sg 9 | >>> D = sg.info(nonick = True) 10 | >>> P = sgPproject(D['my_project'] , nonick = True) 11 | >>> P.load(['temperature','u']) 12 | >>> # obtain the axes under their names T,X,Y,Z in namespace: 13 | >>> for c in P['some_experiment'].axes: 14 | >>> exec c.name + ' = c' 15 | >>> TEMP = P['some_experiment']['temperature'] 16 | >>> U = P['some_experiment']['u'] # zonal velocity 17 | >>> TEMP_sliced = TEMP[Y,:50] # slice in Y-direction 18 | >>> m_TEMP = TEMP_sliced/(X*Y) # take zonal mean 19 | >>> TEMP_regridded = TEMP.regrid(U.gr) # U on different grid 20 | 21 | 22 | Features 23 | -------- 24 | 25 | - A numpy array with grid allowing automatic alignment and dimension broadcasting 26 | - Easy to use and intuitive regridding functionality 27 | - A data object model corresponding closely to Netcdf 28 | - Easier IO via abstraction of IO with multiple Netcdf files 29 | - Makes working with output of many experiments easy via aggregation methods 30 | - The Field class eliminates errors arising from picking the wrong array index 31 | - Quicker plotting due to automatic labels, axes etc. 32 | - Distance-related methods such as spatial differentiation and integration on sphere 33 | - Extensive unit tests and documentation 34 | 35 | There is lots of documentation, both in the source code and elsewhere. Other documentation can be found at: 36 | 37 | - `a practical tutorial `_ 38 | - `a more advanced tutorial `_ 39 | - `an overview of all classes, methods and functions `_ 40 | 41 | 42 | Installation 43 | ------------ 44 | 45 | Install spacegrids simply by running (on command line): 46 | 47 | pip install spacegrids 48 | 49 | On Mac, pip can be installed via "sudo easy_install pip". On Ubuntu/ Debian, install dependencies via package manager if pip install fails: 50 | 51 | apt-get install python-{tk,numpy,matplotlib,scipy} 52 | 53 | 54 | Contribute 55 | ---------- 56 | 57 | - Issue Tracker: github.com/willo12/spacegrids/issues 58 | - Source Code: github.com/willo12/spacegrids 59 | 60 | Support 61 | ------- 62 | 63 | If you are having issues, please let us know. 64 | 65 | License 66 | ------- 67 | 68 | The project is licensed under the BSD license. 69 | -------------------------------------------------------------------------------- /spacegrids/_config.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | import numpy as np 3 | import os 4 | 5 | # choose from netcdf4, scientificio, scipyio 6 | cdf_lib = 'netcdf4' 7 | #cdf_lib = 'scipyio' 8 | 9 | #use_scientificio = False 10 | 11 | # Set the path here. This path will be used to find your experiments. 12 | 13 | if os.getenv("LOC") == "standard": 14 | # For now, the same behaviour as other locations 15 | home_path = os.environ['HOME'] 16 | else: 17 | home_path = os.environ['HOME'] 18 | 19 | # Name of text file designating project directories and containing project name 20 | projnickfile = "projname" 21 | 22 | # flag for field multiplication. Multiplication of directional fields leads to vector fields if true. 23 | strict_vector = True 24 | 25 | # name of subdirectory containing ocean masks. Path is relative to project directories and experiment directories. 26 | 27 | # Names of axis direction names, to be used in figure labels and such: 28 | # Corresponds to axis property of coord object. 29 | ax_disp_names = {'X':'Longitude','Y':'Latitude','Z':'Depth','T':'Time'} 30 | 31 | # global node stack for search function to find out if coord objects are equivalent: 32 | nodes_done = [] 33 | 34 | mask_dir = '/masks/' 35 | # these hard coded axes names (to indicate T-grid) are only used for masks 36 | tgrid_names = {'UVic2.8_t':('yt','xt'),'UVic2.9_t':('latitude','longitude')} 37 | 38 | # keywords by which coordinate grid type (e.g. tracer grid) can be identified/ guessed from description (long_name attribute) in netcdf file: 39 | grid_type_names = {'ts_grid':['t grid','TS grid'],'uv_grid':['u grid','UV grid']} 40 | 41 | # globs by which netcdf files are recognised. 42 | cdf_file_extensions = ['*.nc','*.cdf'] 43 | 44 | 45 | 46 | # flag determining whether scripts are verbose. Default is not. 47 | 48 | verbosity = 0 49 | 50 | # Some useful constants: 51 | 52 | R = 6370.0e3; 53 | g = 9.806 54 | zero_kelvin = -273.15 55 | omega = np.pi/43082.0 56 | angleStep = np.pi * 2 / 360 57 | month_len=(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) 58 | 59 | 60 | # ---------- names by which Netcdf files are searched -------------- 61 | 62 | # keywords by which coordinate spatial/ time direction (e.g. x-direction) can be identified/ guessed from description (long_name attribute) in netcdf file. 63 | # strings starting with ! indicate keywords that should NOT appear in the descriptions. These denied keywords have precedence over the allowed keywords. 64 | # string starting with ? must match precisely. 65 | 66 | coord_dir_names = {'x_dir_names' : ['eastward','zonal','longitude','?x','?e','?lon'], 67 | 'y_dir_names' : ['northward','meridional','latitude','?y','?n','?lat'], 68 | 'z_dir_names' : ['upward','vertical','depth','pressure','!surface','level','?z','elev'], 69 | 't_dir_names' : ['time','year','?t']} 70 | 71 | edge_names = ['edges','bounds'] 72 | 73 | fval_names = ['missing_value','fill_value','_FillValue'] 74 | 75 | 76 | # Formatting function used for warnings. 77 | 78 | def warning_on_one_line(message, category, filename, lineno, file=None, line=None): 79 | return ' %s:%s: %s:%s \n' % (filename, lineno, category.__name__, message) 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Spacegrids 2 | ========== 3 | 4 | Spacegrids is an open source library providing a Numpy array with grids, labelled axes and associated grid-related mathematical methods such as regridding and integration. Spacegrids provides an object data model of Netcdf data that ensures consistency between a Numpy data array and its grid under common operations (and so avoiding common pitfalls related to axis interpretation), and much more. It is a write less do more library for everyday use. 5 | 6 | These `interactive plots from Netcdf data `_ are based on Spacegrids. 7 | 8 | The Field, Gr (grid) and Coord objects make everyday use easy: 9 | 10 | >>> import spacegrids as sg 11 | >>> D = sg.info(nonick = True) 12 | >>> P = sgPproject(D['my_project'] , nonick = True) 13 | >>> P.load(['temperature','u']) 14 | >>> # obtain the axes objects under their names T,X,Y,Z: 15 | >>> for c in P['some_experiment'].axes: 16 | >>> exec c.name + ' = c' # now we can refer to X,Y 17 | >>> TEMP = P['some_experiment']['temperature'] 18 | >>> U = P['some_experiment']['u'] # zonal velocity 19 | >>> TEMP_sliced = TEMP[Y,:50] # slice. Note Y axis object 20 | >>> m_TEMP = TEMP_sliced/(X*Y) # take hor. mean 21 | >>> TEMP_regridded = TEMP.regrid(U.gr) # U grid differs 22 | 23 | 24 | Features 25 | -------- 26 | 27 | - A numpy array with grid allowing automatic alignment and dimension broadcasting 28 | - Easy to use and intuitive regridding functionality 29 | - A data object model corresponding closely to Netcdf 30 | - Easier IO via abstraction of IO with multiple Netcdf files 31 | - Makes working with output of many experiments easy via aggregation methods 32 | - The Field class eliminates errors arising from picking the wrong array index 33 | - Quicker plotting due to automatic labels, axes etc. 34 | - Distance-related methods such as spatial differentiation and integration on sphere 35 | - Extensive unit tests and documentation 36 | 37 | There is lots of documentation, both in the source code and elsewhere. Other documentation can be found at: 38 | 39 | - `a practical tutorial `_ 40 | - `a more advanced tutorial `_ 41 | - `an overview of all classes, methods and functions `_ 42 | - `interactive Netcdf data plots `_ based on Spacegrids 43 | 44 | 45 | Installation 46 | ------------ 47 | 48 | Install spacegrids simply by running (on command line): 49 | 50 | pip install spacegrids 51 | 52 | Dependencies: numpy, scipy, matplotlib (NetCDF4 optional). On Ubuntu/ Debian, install dependencies via package manager if pip install fails: 53 | 54 | apt-get install python-{tk,numpy,matplotlib,scipy} 55 | 56 | On Mac, pip can be installed via "sudo easy_install pip". 57 | 58 | 59 | Contribute 60 | ---------- 61 | 62 | - Issue Tracker: github.com/willo12/spacegrids/issues 63 | - Source Code: github.com/willo12/spacegrids 64 | 65 | Support 66 | ------- 67 | 68 | If you are having issues, please let us know. 69 | 70 | License 71 | ------- 72 | 73 | The project is licensed under the BSD license. 74 | -------------------------------------------------------------------------------- /docs/_build/html/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Search — spacegrids documentation 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 49 | 50 |
51 |
52 |
53 |
54 | 55 |

Search

56 |
57 | 58 |

59 | Please activate JavaScript to enable the search 60 | functionality. 61 |

62 |
63 |

64 | From here you can search these documents. Enter your search 65 | words into the box below and click "search". Note that the search 66 | function will automatically search for all of the words. Pages 67 | containing fewer words won't appear in the result list. 68 |

69 |
70 | 71 | 72 | 73 |
74 | 75 |
76 | 77 |
78 | 79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | 100 | 104 | 105 | -------------------------------------------------------------------------------- /docs/_build/html/_modules/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Overview: module code — spacegrids documentation 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 43 | 44 |
45 |
46 |
47 |
48 | 49 |

All modules for which code is available

50 | 58 | 59 |
60 |
61 |
62 |
63 |
64 | 76 | 77 |
78 |
79 |
80 |
81 | 93 | 97 | 98 | -------------------------------------------------------------------------------- /docs/_build/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #eeffcc; } 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #666666 } /* Operator */ 7 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 8 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 9 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 10 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 11 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 12 | .highlight .ge { font-style: italic } /* Generic.Emph */ 13 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 14 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 15 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 16 | .highlight .go { color: #303030 } /* Generic.Output */ 17 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 18 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 19 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 20 | .highlight .gt { color: #0040D0 } /* Generic.Traceback */ 21 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 22 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 23 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 24 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 25 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 26 | .highlight .kt { color: #902000 } /* Keyword.Type */ 27 | .highlight .m { color: #208050 } /* Literal.Number */ 28 | .highlight .s { color: #4070a0 } /* Literal.String */ 29 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 30 | .highlight .nb { color: #007020 } /* Name.Builtin */ 31 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 32 | .highlight .no { color: #60add5 } /* Name.Constant */ 33 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 34 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 35 | .highlight .ne { color: #007020 } /* Name.Exception */ 36 | .highlight .nf { color: #06287e } /* Name.Function */ 37 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 38 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 39 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 40 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 41 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 42 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 43 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 44 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 45 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 46 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 47 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 48 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 49 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 50 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 51 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 52 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 53 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 54 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 55 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 56 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 57 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 58 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 59 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 60 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 61 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 62 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /docs/_build/html/_static/default.css: -------------------------------------------------------------------------------- 1 | /* 2 | * default.css_t 3 | * ~~~~~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- default theme. 6 | * 7 | * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | @import url("basic.css"); 13 | 14 | /* -- page layout ----------------------------------------------------------- */ 15 | 16 | body { 17 | font-family: sans-serif; 18 | font-size: 100%; 19 | background-color: #11303d; 20 | color: #000; 21 | margin: 0; 22 | padding: 0; 23 | } 24 | 25 | div.document { 26 | background-color: #1c4e63; 27 | } 28 | 29 | div.documentwrapper { 30 | float: left; 31 | width: 100%; 32 | } 33 | 34 | div.bodywrapper { 35 | margin: 0 0 0 230px; 36 | } 37 | 38 | div.body { 39 | background-color: #ffffff; 40 | color: #000000; 41 | padding: 0 20px 30px 20px; 42 | } 43 | 44 | div.footer { 45 | color: #ffffff; 46 | width: 100%; 47 | padding: 9px 0 9px 0; 48 | text-align: center; 49 | font-size: 75%; 50 | } 51 | 52 | div.footer a { 53 | color: #ffffff; 54 | text-decoration: underline; 55 | } 56 | 57 | div.related { 58 | background-color: #133f52; 59 | line-height: 30px; 60 | color: #ffffff; 61 | } 62 | 63 | div.related a { 64 | color: #ffffff; 65 | } 66 | 67 | div.sphinxsidebar { 68 | } 69 | 70 | div.sphinxsidebar h3 { 71 | font-family: 'Trebuchet MS', sans-serif; 72 | color: #ffffff; 73 | font-size: 1.4em; 74 | font-weight: normal; 75 | margin: 0; 76 | padding: 0; 77 | } 78 | 79 | div.sphinxsidebar h3 a { 80 | color: #ffffff; 81 | } 82 | 83 | div.sphinxsidebar h4 { 84 | font-family: 'Trebuchet MS', sans-serif; 85 | color: #ffffff; 86 | font-size: 1.3em; 87 | font-weight: normal; 88 | margin: 5px 0 0 0; 89 | padding: 0; 90 | } 91 | 92 | div.sphinxsidebar p { 93 | color: #ffffff; 94 | } 95 | 96 | div.sphinxsidebar p.topless { 97 | margin: 5px 10px 10px 10px; 98 | } 99 | 100 | div.sphinxsidebar ul { 101 | margin: 10px; 102 | padding: 0; 103 | color: #ffffff; 104 | } 105 | 106 | div.sphinxsidebar a { 107 | color: #98dbcc; 108 | } 109 | 110 | div.sphinxsidebar input { 111 | border: 1px solid #98dbcc; 112 | font-family: sans-serif; 113 | font-size: 1em; 114 | } 115 | 116 | 117 | 118 | /* -- hyperlink styles ------------------------------------------------------ */ 119 | 120 | a { 121 | color: #355f7c; 122 | text-decoration: none; 123 | } 124 | 125 | a:visited { 126 | color: #355f7c; 127 | text-decoration: none; 128 | } 129 | 130 | a:hover { 131 | text-decoration: underline; 132 | } 133 | 134 | 135 | 136 | /* -- body styles ----------------------------------------------------------- */ 137 | 138 | div.body h1, 139 | div.body h2, 140 | div.body h3, 141 | div.body h4, 142 | div.body h5, 143 | div.body h6 { 144 | font-family: 'Trebuchet MS', sans-serif; 145 | background-color: #f2f2f2; 146 | font-weight: normal; 147 | color: #20435c; 148 | border-bottom: 1px solid #ccc; 149 | margin: 20px -20px 10px -20px; 150 | padding: 3px 0 3px 10px; 151 | } 152 | 153 | div.body h1 { margin-top: 0; font-size: 200%; } 154 | div.body h2 { font-size: 160%; } 155 | div.body h3 { font-size: 140%; } 156 | div.body h4 { font-size: 120%; } 157 | div.body h5 { font-size: 110%; } 158 | div.body h6 { font-size: 100%; } 159 | 160 | a.headerlink { 161 | color: #c60f0f; 162 | font-size: 0.8em; 163 | padding: 0 4px 0 4px; 164 | text-decoration: none; 165 | } 166 | 167 | a.headerlink:hover { 168 | background-color: #c60f0f; 169 | color: white; 170 | } 171 | 172 | div.body p, div.body dd, div.body li { 173 | text-align: justify; 174 | line-height: 130%; 175 | } 176 | 177 | div.admonition p.admonition-title + p { 178 | display: inline; 179 | } 180 | 181 | div.admonition p { 182 | margin-bottom: 5px; 183 | } 184 | 185 | div.admonition pre { 186 | margin-bottom: 5px; 187 | } 188 | 189 | div.admonition ul, div.admonition ol { 190 | margin-bottom: 5px; 191 | } 192 | 193 | div.note { 194 | background-color: #eee; 195 | border: 1px solid #ccc; 196 | } 197 | 198 | div.seealso { 199 | background-color: #ffc; 200 | border: 1px solid #ff6; 201 | } 202 | 203 | div.topic { 204 | background-color: #eee; 205 | } 206 | 207 | div.warning { 208 | background-color: #ffe4e4; 209 | border: 1px solid #f66; 210 | } 211 | 212 | p.admonition-title { 213 | display: inline; 214 | } 215 | 216 | p.admonition-title:after { 217 | content: ":"; 218 | } 219 | 220 | pre { 221 | padding: 5px; 222 | background-color: #eeffcc; 223 | color: #333333; 224 | line-height: 120%; 225 | border: 1px solid #ac9; 226 | border-left: none; 227 | border-right: none; 228 | } 229 | 230 | tt { 231 | background-color: #ecf0f3; 232 | padding: 0 1px 0 1px; 233 | font-size: 0.95em; 234 | } 235 | 236 | th { 237 | background-color: #ede; 238 | } 239 | 240 | .warning tt { 241 | background: #efc2c2; 242 | } 243 | 244 | .note tt { 245 | background: #d6d6d6; 246 | } 247 | 248 | .viewcode-back { 249 | font-family: sans-serif; 250 | } 251 | 252 | div.viewcode-block:target { 253 | background-color: #f4debf; 254 | border-top: 1px solid #ac9; 255 | border-bottom: 1px solid #ac9; 256 | } -------------------------------------------------------------------------------- /docs/_build/html/_static/sidebar.js: -------------------------------------------------------------------------------- 1 | /* 2 | * sidebar.js 3 | * ~~~~~~~~~~ 4 | * 5 | * This script makes the Sphinx sidebar collapsible. 6 | * 7 | * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds 8 | * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton 9 | * used to collapse and expand the sidebar. 10 | * 11 | * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden 12 | * and the width of the sidebar and the margin-left of the document 13 | * are decreased. When the sidebar is expanded the opposite happens. 14 | * This script saves a per-browser/per-session cookie used to 15 | * remember the position of the sidebar among the pages. 16 | * Once the browser is closed the cookie is deleted and the position 17 | * reset to the default (expanded). 18 | * 19 | * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. 20 | * :license: BSD, see LICENSE for details. 21 | * 22 | */ 23 | 24 | $(function() { 25 | // global elements used by the functions. 26 | // the 'sidebarbutton' element is defined as global after its 27 | // creation, in the add_sidebar_button function 28 | var bodywrapper = $('.bodywrapper'); 29 | var sidebar = $('.sphinxsidebar'); 30 | var sidebarwrapper = $('.sphinxsidebarwrapper'); 31 | 32 | // for some reason, the document has no sidebar; do not run into errors 33 | if (!sidebar.length) return; 34 | 35 | // original margin-left of the bodywrapper and width of the sidebar 36 | // with the sidebar expanded 37 | var bw_margin_expanded = bodywrapper.css('margin-left'); 38 | var ssb_width_expanded = sidebar.width(); 39 | 40 | // margin-left of the bodywrapper and width of the sidebar 41 | // with the sidebar collapsed 42 | var bw_margin_collapsed = '.8em'; 43 | var ssb_width_collapsed = '.8em'; 44 | 45 | // colors used by the current theme 46 | var dark_color = $('.related').css('background-color'); 47 | var light_color = $('.document').css('background-color'); 48 | 49 | function sidebar_is_collapsed() { 50 | return sidebarwrapper.is(':not(:visible)'); 51 | } 52 | 53 | function toggle_sidebar() { 54 | if (sidebar_is_collapsed()) 55 | expand_sidebar(); 56 | else 57 | collapse_sidebar(); 58 | } 59 | 60 | function collapse_sidebar() { 61 | sidebarwrapper.hide(); 62 | sidebar.css('width', ssb_width_collapsed); 63 | bodywrapper.css('margin-left', bw_margin_collapsed); 64 | sidebarbutton.css({ 65 | 'margin-left': '0', 66 | 'height': bodywrapper.height() 67 | }); 68 | sidebarbutton.find('span').text('»'); 69 | sidebarbutton.attr('title', _('Expand sidebar')); 70 | document.cookie = 'sidebar=collapsed'; 71 | } 72 | 73 | function expand_sidebar() { 74 | bodywrapper.css('margin-left', bw_margin_expanded); 75 | sidebar.css('width', ssb_width_expanded); 76 | sidebarwrapper.show(); 77 | sidebarbutton.css({ 78 | 'margin-left': ssb_width_expanded-12, 79 | 'height': bodywrapper.height() 80 | }); 81 | sidebarbutton.find('span').text('«'); 82 | sidebarbutton.attr('title', _('Collapse sidebar')); 83 | document.cookie = 'sidebar=expanded'; 84 | } 85 | 86 | function add_sidebar_button() { 87 | sidebarwrapper.css({ 88 | 'float': 'left', 89 | 'margin-right': '0', 90 | 'width': ssb_width_expanded - 28 91 | }); 92 | // create the button 93 | sidebar.append( 94 | '
«
' 95 | ); 96 | var sidebarbutton = $('#sidebarbutton'); 97 | light_color = sidebarbutton.css('background-color'); 98 | // find the height of the viewport to center the '<<' in the page 99 | var viewport_height; 100 | if (window.innerHeight) 101 | viewport_height = window.innerHeight; 102 | else 103 | viewport_height = $(window).height(); 104 | sidebarbutton.find('span').css({ 105 | 'display': 'block', 106 | 'margin-top': (viewport_height - sidebar.position().top - 20) / 2 107 | }); 108 | 109 | sidebarbutton.click(toggle_sidebar); 110 | sidebarbutton.attr('title', _('Collapse sidebar')); 111 | sidebarbutton.css({ 112 | 'color': '#FFFFFF', 113 | 'border-left': '1px solid ' + dark_color, 114 | 'font-size': '1.2em', 115 | 'cursor': 'pointer', 116 | 'height': bodywrapper.height(), 117 | 'padding-top': '1px', 118 | 'margin-left': ssb_width_expanded - 12 119 | }); 120 | 121 | sidebarbutton.hover( 122 | function () { 123 | $(this).css('background-color', dark_color); 124 | }, 125 | function () { 126 | $(this).css('background-color', light_color); 127 | } 128 | ); 129 | } 130 | 131 | function set_position_from_cookie() { 132 | if (!document.cookie) 133 | return; 134 | var items = document.cookie.split(';'); 135 | for(var k=0; k 5 | 6 | 7 | 8 | 9 | 10 | 11 | Python Module Index — spacegrids documentation 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 46 | 47 |
48 |
49 |
50 |
51 | 52 | 53 |

Python Module Index

54 | 55 |
56 | s 57 |
58 | 59 | 60 | 61 | 63 | 64 | 66 | 69 | 70 | 71 | 74 | 75 | 76 | 79 | 80 | 81 | 84 | 85 | 86 | 89 | 90 | 91 | 94 | 95 | 96 | 99 | 100 | 101 | 104 | 105 | 106 | 109 |
 
62 | s
67 | spacegrids 68 |
    72 | spacegrids.__init__ 73 |
    77 | spacegrids.abstract 78 |
    82 | spacegrids.expercls 83 |
    87 | spacegrids.fieldcls 88 |
    92 | spacegrids.ops 93 |
    97 | spacegrids.plotting 98 |
    102 | spacegrids.projectcls 103 |
    107 | spacegrids.utilsg 108 |
110 | 111 | 112 |
113 |
114 |
115 |
116 |
117 | 129 | 130 |
131 |
132 |
133 |
134 | 146 | 150 | 151 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=_build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . 10 | set I18NSPHINXOPTS=%SPHINXOPTS% . 11 | if NOT "%PAPER%" == "" ( 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 14 | ) 15 | 16 | if "%1" == "" goto help 17 | 18 | if "%1" == "help" ( 19 | :help 20 | echo.Please use `make ^` where ^ is one of 21 | echo. html to make standalone HTML files 22 | echo. dirhtml to make HTML files named index.html in directories 23 | echo. singlehtml to make a single large HTML file 24 | echo. pickle to make pickle files 25 | echo. json to make JSON files 26 | echo. htmlhelp to make HTML files and a HTML help project 27 | echo. qthelp to make HTML files and a qthelp project 28 | echo. devhelp to make HTML files and a Devhelp project 29 | echo. epub to make an epub 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 31 | echo. text to make text files 32 | echo. man to make manual pages 33 | echo. texinfo to make Texinfo files 34 | echo. gettext to make PO message catalogs 35 | echo. changes to make an overview over all changed/added/deprecated items 36 | echo. linkcheck to check all external links for integrity 37 | echo. doctest to run all doctests embedded in the documentation if enabled 38 | goto end 39 | ) 40 | 41 | if "%1" == "clean" ( 42 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 43 | del /q /s %BUILDDIR%\* 44 | goto end 45 | ) 46 | 47 | if "%1" == "html" ( 48 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 49 | if errorlevel 1 exit /b 1 50 | echo. 51 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 52 | goto end 53 | ) 54 | 55 | if "%1" == "dirhtml" ( 56 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 57 | if errorlevel 1 exit /b 1 58 | echo. 59 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 60 | goto end 61 | ) 62 | 63 | if "%1" == "singlehtml" ( 64 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 65 | if errorlevel 1 exit /b 1 66 | echo. 67 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 68 | goto end 69 | ) 70 | 71 | if "%1" == "pickle" ( 72 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 73 | if errorlevel 1 exit /b 1 74 | echo. 75 | echo.Build finished; now you can process the pickle files. 76 | goto end 77 | ) 78 | 79 | if "%1" == "json" ( 80 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 81 | if errorlevel 1 exit /b 1 82 | echo. 83 | echo.Build finished; now you can process the JSON files. 84 | goto end 85 | ) 86 | 87 | if "%1" == "htmlhelp" ( 88 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 89 | if errorlevel 1 exit /b 1 90 | echo. 91 | echo.Build finished; now you can run HTML Help Workshop with the ^ 92 | .hhp project file in %BUILDDIR%/htmlhelp. 93 | goto end 94 | ) 95 | 96 | if "%1" == "qthelp" ( 97 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 98 | if errorlevel 1 exit /b 1 99 | echo. 100 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 101 | .qhcp project file in %BUILDDIR%/qthelp, like this: 102 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\spacegrids.qhcp 103 | echo.To view the help file: 104 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\spacegrids.ghc 105 | goto end 106 | ) 107 | 108 | if "%1" == "devhelp" ( 109 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 110 | if errorlevel 1 exit /b 1 111 | echo. 112 | echo.Build finished. 113 | goto end 114 | ) 115 | 116 | if "%1" == "epub" ( 117 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 118 | if errorlevel 1 exit /b 1 119 | echo. 120 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 121 | goto end 122 | ) 123 | 124 | if "%1" == "latex" ( 125 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 126 | if errorlevel 1 exit /b 1 127 | echo. 128 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 129 | goto end 130 | ) 131 | 132 | if "%1" == "text" ( 133 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 134 | if errorlevel 1 exit /b 1 135 | echo. 136 | echo.Build finished. The text files are in %BUILDDIR%/text. 137 | goto end 138 | ) 139 | 140 | if "%1" == "man" ( 141 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 142 | if errorlevel 1 exit /b 1 143 | echo. 144 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 145 | goto end 146 | ) 147 | 148 | if "%1" == "texinfo" ( 149 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 150 | if errorlevel 1 exit /b 1 151 | echo. 152 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 153 | goto end 154 | ) 155 | 156 | if "%1" == "gettext" ( 157 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 158 | if errorlevel 1 exit /b 1 159 | echo. 160 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 161 | goto end 162 | ) 163 | 164 | if "%1" == "changes" ( 165 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 166 | if errorlevel 1 exit /b 1 167 | echo. 168 | echo.The overview file is in %BUILDDIR%/changes. 169 | goto end 170 | ) 171 | 172 | if "%1" == "linkcheck" ( 173 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 174 | if errorlevel 1 exit /b 1 175 | echo. 176 | echo.Link check complete; look for any errors in the above output ^ 177 | or in %BUILDDIR%/linkcheck/output.txt. 178 | goto end 179 | ) 180 | 181 | if "%1" == "doctest" ( 182 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 183 | if errorlevel 1 exit /b 1 184 | echo. 185 | echo.Testing of doctests in the sources finished, look at the ^ 186 | results in %BUILDDIR%/doctest/output.txt. 187 | goto end 188 | ) 189 | 190 | :end 191 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 14 | # the i18n builder cannot share the environment and doctrees with the others 15 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 16 | 17 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 18 | 19 | help: 20 | @echo "Please use \`make ' where is one of" 21 | @echo " html to make standalone HTML files" 22 | @echo " dirhtml to make HTML files named index.html in directories" 23 | @echo " singlehtml to make a single large HTML file" 24 | @echo " pickle to make pickle files" 25 | @echo " json to make JSON files" 26 | @echo " htmlhelp to make HTML files and a HTML help project" 27 | @echo " qthelp to make HTML files and a qthelp project" 28 | @echo " devhelp to make HTML files and a Devhelp project" 29 | @echo " epub to make an epub" 30 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 31 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 32 | @echo " text to make text files" 33 | @echo " man to make manual pages" 34 | @echo " texinfo to make Texinfo files" 35 | @echo " info to make Texinfo files and run them through makeinfo" 36 | @echo " gettext to make PO message catalogs" 37 | @echo " changes to make an overview of all changed/added/deprecated items" 38 | @echo " linkcheck to check all external links for integrity" 39 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 40 | 41 | clean: 42 | -rm -rf $(BUILDDIR)/* 43 | 44 | html: 45 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 46 | @echo 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 48 | 49 | dirhtml: 50 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 51 | @echo 52 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 53 | 54 | singlehtml: 55 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 56 | @echo 57 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 58 | 59 | pickle: 60 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 61 | @echo 62 | @echo "Build finished; now you can process the pickle files." 63 | 64 | json: 65 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 66 | @echo 67 | @echo "Build finished; now you can process the JSON files." 68 | 69 | htmlhelp: 70 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 71 | @echo 72 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 73 | ".hhp project file in $(BUILDDIR)/htmlhelp." 74 | 75 | qthelp: 76 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 77 | @echo 78 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 79 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 80 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/spacegrids.qhcp" 81 | @echo "To view the help file:" 82 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/spacegrids.qhc" 83 | 84 | devhelp: 85 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 86 | @echo 87 | @echo "Build finished." 88 | @echo "To view the help file:" 89 | @echo "# mkdir -p $$HOME/.local/share/devhelp/spacegrids" 90 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/spacegrids" 91 | @echo "# devhelp" 92 | 93 | epub: 94 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 95 | @echo 96 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 97 | 98 | latex: 99 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 100 | @echo 101 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 102 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 103 | "(use \`make latexpdf' here to do that automatically)." 104 | 105 | latexpdf: 106 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 107 | @echo "Running LaTeX files through pdflatex..." 108 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 109 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 110 | 111 | text: 112 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 113 | @echo 114 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 115 | 116 | man: 117 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 118 | @echo 119 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 120 | 121 | texinfo: 122 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 123 | @echo 124 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 125 | @echo "Run \`make' in that directory to run these through makeinfo" \ 126 | "(use \`make info' here to do that automatically)." 127 | 128 | info: 129 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 130 | @echo "Running Texinfo files through makeinfo..." 131 | make -C $(BUILDDIR)/texinfo info 132 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 133 | 134 | gettext: 135 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 136 | @echo 137 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 138 | 139 | changes: 140 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 141 | @echo 142 | @echo "The overview file is in $(BUILDDIR)/changes." 143 | 144 | linkcheck: 145 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 146 | @echo 147 | @echo "Link check complete; look for any errors in the above output " \ 148 | "or in $(BUILDDIR)/linkcheck/output.txt." 149 | 150 | doctest: 151 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 152 | @echo "Testing of doctests in the sources finished, look at the " \ 153 | "results in $(BUILDDIR)/doctest/output.txt." 154 | -------------------------------------------------------------------------------- /spacegrids/_iosg.py: -------------------------------------------------------------------------------- 1 | #encoding:utf-8 2 | 3 | """ io related 4 | """ 5 | 6 | import numpy as np 7 | 8 | from _config import * 9 | 10 | import warnings 11 | warnings.formatwarning = warning_on_one_line 12 | 13 | # use_scientificio is set in config 14 | #use_scientificio = False 15 | 16 | # fallback is always scipy.io: least dependencies 17 | 18 | # cdf_lib set in _config.py and determines which library to use 19 | 20 | if cdf_lib =='netcdf4': 21 | try: 22 | from netCDF4 import Dataset 23 | cdf_lib_used = 'netcdf4' 24 | # print 'Using netCDF4' 25 | except: 26 | warnings.warn('no Netcdf4. Reverting to scipy.') 27 | from scipy.io import netcdf 28 | cdf_lib_used = 'scipyio' 29 | 30 | elif cdf_lib == 'scientificio': 31 | try: 32 | import Scientific.IO.NetCDF 33 | print 'Using Scientific.IO.NetCDF' 34 | cdf_lib_used = 'scientificio' 35 | except: 36 | warnings.warn('no Scientific io. Reverting to scipy.') 37 | from scipy.io import netcdf 38 | cdf_lib_used = 'scipyio' 39 | else: 40 | from scipy.io import netcdf 41 | cdf_lib_used = 'scipyio' 42 | print 'Using scipyio' 43 | import os 44 | 45 | from fieldcls import * 46 | 47 | 48 | 49 | def netcdf_file(filepath,mode = 'r', *args, **kwargs): 50 | """ 51 | Wrapper for opening Netcdf functions from NETCDF4, ScientificIO or Scipy 52 | 53 | Depends on cdf_lib_used variable. 54 | 55 | For 'netcdf4': 56 | file = Dataset(filepath,mode, format='NETCDF4') 57 | For 'scientificio': 58 | file = Scientific.IO.NetCDF.NetCDFFile(filename = filepath, mode = mode) 59 | Otherwise: 60 | file = netcdf.netcdf_file(filename = filepath, mode = mode, *args, **kwargs) 61 | 62 | Args: 63 | filepath: (str) full path to file 64 | mode: (str) mode to use as mode argument to file opening function 65 | 66 | Returns: 67 | file handle if successful. 68 | 69 | Raises: 70 | IOError if there are problems opening the file. 71 | """ 72 | 73 | if cdf_lib_used =='netcdf4': 74 | 75 | try: 76 | file = Dataset(filepath,mode, format='NETCDF4', *args, **kwargs) 77 | 78 | except IOError: 79 | raise IOError('Cannot open %s using NetCDF4'%filepath) 80 | 81 | else: 82 | return file 83 | 84 | if cdf_lib_used == 'scientificio': 85 | try: 86 | file = Scientific.IO.NetCDF.NetCDFFile(filename = filepath, mode = mode, *args, **kwargs) 87 | except IOError: 88 | raise IOError('Cannot open %s using Scientific.IO'%filepath) 89 | 90 | else: 91 | return file 92 | 93 | 94 | else: 95 | # Scipy way: 96 | 97 | try: 98 | file = netcdf.netcdf_file(filename = filepath, mode = mode, *args, **kwargs) 99 | except IOError: 100 | raise IOError('Cannot open %s using Scipy'%filepath) 101 | else: 102 | return file 103 | 104 | 105 | 106 | 107 | def msk_read(filepath='masks/msk', crop = 1): 108 | """ 109 | Reads a text file containing a mask pointed to by filepath and returns a corresponding array. 110 | 111 | Due to the way these masks are stored for the UVic model, cropping is needed, as indicated 112 | by the crop flag in the arguments. This is the lowest level mask read function in sg. 113 | 114 | Args: 115 | filepath: (str) path to the file 116 | crop: (int) amount of points to crop at the margins. 117 | 118 | Return: 119 | ndarray containing mask. 120 | """ 121 | 122 | str_data = [] 123 | 124 | with open(filepath,'r') as fobj: 125 | str_data = fobj.readlines() 126 | 127 | data = [] 128 | for eachline in str_data: 129 | data_line = [] 130 | for elem in eachline: 131 | try: 132 | data_line.append(int(elem)) 133 | except: 134 | pass 135 | data.append(data_line) 136 | 137 | 138 | if crop: 139 | return np.flipud(np.array(data))[1:-1,1:-1] 140 | else: 141 | return np.flipud(np.array(data)) 142 | 143 | def read_masks(dir_path, msk_shape=None,grids = False, msk_val =2): 144 | """ 145 | Reads mask and returns a list of Field objects containing masks. 146 | 147 | Calls msk_read, see msk_read. 148 | 149 | Args: 150 | dir_path: (str) path to directory 151 | msk_shape: (None or tuple of int) describing supposed shape of mask 152 | grids: (Gr) grid to use for masks 153 | msk_val: (int) value that will not be nan in mask 154 | 155 | Returns: 156 | Dictionary of masks and their names 157 | """ 158 | 159 | if not(grids): 160 | print 'read_masks: Provide grid --> no masks loaded.' 161 | return 162 | 163 | if isinstance(grids,Gr): 164 | grids = [grids] 165 | 166 | try: 167 | L = os.listdir(dir_path) 168 | except: 169 | print "No mask dir." 170 | L=[] 171 | 172 | masks = {} 173 | for it in L: 174 | try: 175 | fpath = os.path.join(dir_path,it) 176 | msk = msk_read(fpath) 177 | 178 | if msk_shape is not None: 179 | # only test shape if msk_shape not default value of None 180 | if (msk.shape != tuple(msk_shape)): 181 | print "Warning: mask shape does not agree: " + it, 182 | print msk.shape, 183 | print msk_shape 184 | msk = np.array(msk,dtype = np.float32) 185 | 186 | if msk_val: 187 | msk[msk != msk_val] = np.nan 188 | msk[msk == msk_val] = 1 189 | 190 | for g in grids: 191 | try: 192 | print 'Trying to join mask and grid to create Field, ignore possibe error.' 193 | mskob = Field(name = it, value = msk, grid =g) 194 | break 195 | except: 196 | pass 197 | 198 | masks[it] = mskob 199 | 200 | except: 201 | print "No mask." 202 | 203 | return masks 204 | 205 | 206 | def locate(top = '/home/',fname = projnickfile): 207 | """ 208 | Locates all files with filename fname. Helper function to info function. 209 | 210 | Args: 211 | top: (str) the start dir 212 | fname: (str)the filename to look for. 213 | 214 | 215 | Returns: 216 | List of all paths to dirs containing fname. 217 | """ 218 | 219 | 220 | paths = [] 221 | if fname is not None: 222 | 223 | for root, dirs, files in os.walk(top=top): 224 | if fname in files: 225 | paths.append(root) 226 | 227 | else: 228 | paths = [ os.path.join(top,subdir) for subdir in os.listdir(top) ] 229 | 230 | 231 | return paths 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | -------------------------------------------------------------------------------- /docs/_build/html/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * doctools.js 3 | * ~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilities for all documentation. 6 | * 7 | * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /** 13 | * select a different prefix for underscore 14 | */ 15 | $u = _.noConflict(); 16 | 17 | /** 18 | * make the code below compatible with browsers without 19 | * an installed firebug like debugger 20 | if (!window.console || !console.firebug) { 21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", 22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", 23 | "profile", "profileEnd"]; 24 | window.console = {}; 25 | for (var i = 0; i < names.length; ++i) 26 | window.console[names[i]] = function() {}; 27 | } 28 | */ 29 | 30 | /** 31 | * small helper function to urldecode strings 32 | */ 33 | jQuery.urldecode = function(x) { 34 | return decodeURIComponent(x).replace(/\+/g, ' '); 35 | } 36 | 37 | /** 38 | * small helper function to urlencode strings 39 | */ 40 | jQuery.urlencode = encodeURIComponent; 41 | 42 | /** 43 | * This function returns the parsed url parameters of the 44 | * current request. Multiple values per key are supported, 45 | * it will always return arrays of strings for the value parts. 46 | */ 47 | jQuery.getQueryParameters = function(s) { 48 | if (typeof s == 'undefined') 49 | s = document.location.search; 50 | var parts = s.substr(s.indexOf('?') + 1).split('&'); 51 | var result = {}; 52 | for (var i = 0; i < parts.length; i++) { 53 | var tmp = parts[i].split('=', 2); 54 | var key = jQuery.urldecode(tmp[0]); 55 | var value = jQuery.urldecode(tmp[1]); 56 | if (key in result) 57 | result[key].push(value); 58 | else 59 | result[key] = [value]; 60 | } 61 | return result; 62 | }; 63 | 64 | /** 65 | * small function to check if an array contains 66 | * a given item. 67 | */ 68 | jQuery.contains = function(arr, item) { 69 | for (var i = 0; i < arr.length; i++) { 70 | if (arr[i] == item) 71 | return true; 72 | } 73 | return false; 74 | }; 75 | 76 | /** 77 | * highlight a given string on a jquery object by wrapping it in 78 | * span elements with the given class name. 79 | */ 80 | jQuery.fn.highlightText = function(text, className) { 81 | function highlight(node) { 82 | if (node.nodeType == 3) { 83 | var val = node.nodeValue; 84 | var pos = val.toLowerCase().indexOf(text); 85 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { 86 | var span = document.createElement("span"); 87 | span.className = className; 88 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 89 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( 90 | document.createTextNode(val.substr(pos + text.length)), 91 | node.nextSibling)); 92 | node.nodeValue = val.substr(0, pos); 93 | } 94 | } 95 | else if (!jQuery(node).is("button, select, textarea")) { 96 | jQuery.each(node.childNodes, function() { 97 | highlight(this); 98 | }); 99 | } 100 | } 101 | return this.each(function() { 102 | highlight(this); 103 | }); 104 | }; 105 | 106 | /** 107 | * Small JavaScript module for the documentation. 108 | */ 109 | var Documentation = { 110 | 111 | init : function() { 112 | this.fixFirefoxAnchorBug(); 113 | this.highlightSearchWords(); 114 | this.initIndexTable(); 115 | }, 116 | 117 | /** 118 | * i18n support 119 | */ 120 | TRANSLATIONS : {}, 121 | PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, 122 | LOCALE : 'unknown', 123 | 124 | // gettext and ngettext don't access this so that the functions 125 | // can safely bound to a different name (_ = Documentation.gettext) 126 | gettext : function(string) { 127 | var translated = Documentation.TRANSLATIONS[string]; 128 | if (typeof translated == 'undefined') 129 | return string; 130 | return (typeof translated == 'string') ? translated : translated[0]; 131 | }, 132 | 133 | ngettext : function(singular, plural, n) { 134 | var translated = Documentation.TRANSLATIONS[singular]; 135 | if (typeof translated == 'undefined') 136 | return (n == 1) ? singular : plural; 137 | return translated[Documentation.PLURALEXPR(n)]; 138 | }, 139 | 140 | addTranslations : function(catalog) { 141 | for (var key in catalog.messages) 142 | this.TRANSLATIONS[key] = catalog.messages[key]; 143 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); 144 | this.LOCALE = catalog.locale; 145 | }, 146 | 147 | /** 148 | * add context elements like header anchor links 149 | */ 150 | addContextElements : function() { 151 | $('div[id] > :header:first').each(function() { 152 | $('\u00B6'). 153 | attr('href', '#' + this.id). 154 | attr('title', _('Permalink to this headline')). 155 | appendTo(this); 156 | }); 157 | $('dt[id]').each(function() { 158 | $('\u00B6'). 159 | attr('href', '#' + this.id). 160 | attr('title', _('Permalink to this definition')). 161 | appendTo(this); 162 | }); 163 | }, 164 | 165 | /** 166 | * workaround a firefox stupidity 167 | */ 168 | fixFirefoxAnchorBug : function() { 169 | if (document.location.hash && $.browser.mozilla) 170 | window.setTimeout(function() { 171 | document.location.href += ''; 172 | }, 10); 173 | }, 174 | 175 | /** 176 | * highlight the search words provided in the url in the text 177 | */ 178 | highlightSearchWords : function() { 179 | var params = $.getQueryParameters(); 180 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; 181 | if (terms.length) { 182 | var body = $('div.body'); 183 | window.setTimeout(function() { 184 | $.each(terms, function() { 185 | body.highlightText(this.toLowerCase(), 'highlighted'); 186 | }); 187 | }, 10); 188 | $('') 190 | .appendTo($('#searchbox')); 191 | } 192 | }, 193 | 194 | /** 195 | * init the domain index toggle buttons 196 | */ 197 | initIndexTable : function() { 198 | var togglers = $('img.toggler').click(function() { 199 | var src = $(this).attr('src'); 200 | var idnum = $(this).attr('id').substr(7); 201 | $('tr.cg-' + idnum).toggle(); 202 | if (src.substr(-9) == 'minus.png') 203 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 204 | else 205 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 206 | }).css('display', ''); 207 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 208 | togglers.click(); 209 | } 210 | }, 211 | 212 | /** 213 | * helper function to hide the search marks again 214 | */ 215 | hideSearchWords : function() { 216 | $('#searchbox .highlight-link').fadeOut(300); 217 | $('span.highlighted').removeClass('highlighted'); 218 | }, 219 | 220 | /** 221 | * make the url absolute 222 | */ 223 | makeURL : function(relativeURL) { 224 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 225 | }, 226 | 227 | /** 228 | * get the current relative url 229 | */ 230 | getCurrentURL : function() { 231 | var path = document.location.pathname; 232 | var parts = path.split(/\//); 233 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 234 | if (this == '..') 235 | parts.pop(); 236 | }); 237 | var url = parts.join('/'); 238 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 239 | } 240 | }; 241 | 242 | // quick alias for translations 243 | _ = Documentation.gettext; 244 | 245 | $(document).ready(function() { 246 | Documentation.init(); 247 | }); 248 | -------------------------------------------------------------------------------- /docs/_build/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Spacegrids data analysis documentation — spacegrids documentation 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 47 | 48 |
49 |
50 |
51 |
52 | 53 |
54 |

Spacegrids data analysis documentation

55 |
56 |

Contents:

57 |
58 |
    59 |
60 |
61 |
62 | 73 |
74 |
75 | 102 |
103 |
104 |
105 |
106 |

Indices and tables

107 | 112 |
113 | 114 | 115 |
116 |
117 |
118 |
119 |
120 |

Table Of Contents

121 | 130 | 131 |

Next topic

132 |

Spacegrids

134 |

This Page

135 | 139 | 151 | 152 |
153 |
154 |
155 |
156 | 171 | 175 | 176 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # spacegrids documentation build configuration file, created by 4 | # sphinx-quickstart on Wed Aug 6 13:45:41 2014. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.insert(0, os.path.abspath('.')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 28 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] 29 | 30 | # Add any paths that contain templates here, relative to this directory. 31 | templates_path = ['_templates'] 32 | 33 | # The suffix of source filenames. 34 | source_suffix = '.rst' 35 | 36 | # The encoding of source files. 37 | #source_encoding = 'utf-8-sig' 38 | 39 | # The master toctree document. 40 | master_doc = 'index' 41 | 42 | # General information about the project. 43 | project = u'spacegrids' 44 | copyright = u'2014, Willem Sijp' 45 | 46 | # The version info for the project you're documenting, acts as replacement for 47 | # |version| and |release|, also used in various other places throughout the 48 | # built documents. 49 | # 50 | # The short X.Y version. 51 | version = '' 52 | # The full version, including alpha/beta/rc tags. 53 | release = '' 54 | 55 | # The language for content autogenerated by Sphinx. Refer to documentation 56 | # for a list of supported languages. 57 | #language = None 58 | 59 | # There are two options for replacing |today|: either, you set today to some 60 | # non-false value, then it is used: 61 | #today = '' 62 | # Else, today_fmt is used as the format for a strftime call. 63 | #today_fmt = '%B %d, %Y' 64 | 65 | # List of patterns, relative to source directory, that match files and 66 | # directories to ignore when looking for source files. 67 | exclude_patterns = ['_build'] 68 | 69 | # The reST default role (used for this markup: `text`) to use for all documents. 70 | #default_role = None 71 | 72 | # If true, '()' will be appended to :func: etc. cross-reference text. 73 | #add_function_parentheses = True 74 | 75 | # If true, the current module name will be prepended to all description 76 | # unit titles (such as .. function::). 77 | #add_module_names = True 78 | 79 | # If true, sectionauthor and moduleauthor directives will be shown in the 80 | # output. They are ignored by default. 81 | #show_authors = False 82 | 83 | # The name of the Pygments (syntax highlighting) style to use. 84 | pygments_style = 'sphinx' 85 | 86 | # A list of ignored prefixes for module index sorting. 87 | #modindex_common_prefix = [] 88 | 89 | 90 | # -- Options for HTML output --------------------------------------------------- 91 | 92 | # The theme to use for HTML and HTML Help pages. See the documentation for 93 | # a list of builtin themes. 94 | html_theme = 'default' 95 | 96 | # Theme options are theme-specific and customize the look and feel of a theme 97 | # further. For a list of options available for each theme, see the 98 | # documentation. 99 | #html_theme_options = {} 100 | 101 | # Add any paths that contain custom themes here, relative to this directory. 102 | #html_theme_path = [] 103 | 104 | # The name for this set of Sphinx documents. If None, it defaults to 105 | # " v documentation". 106 | #html_title = None 107 | 108 | # A shorter title for the navigation bar. Default is the same as html_title. 109 | #html_short_title = None 110 | 111 | # The name of an image file (relative to this directory) to place at the top 112 | # of the sidebar. 113 | #html_logo = None 114 | 115 | # The name of an image file (within the static path) to use as favicon of the 116 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 117 | # pixels large. 118 | #html_favicon = None 119 | 120 | # Add any paths that contain custom static files (such as style sheets) here, 121 | # relative to this directory. They are copied after the builtin static files, 122 | # so a file named "default.css" will overwrite the builtin "default.css". 123 | html_static_path = ['_static'] 124 | 125 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 126 | # using the given strftime format. 127 | #html_last_updated_fmt = '%b %d, %Y' 128 | 129 | # If true, SmartyPants will be used to convert quotes and dashes to 130 | # typographically correct entities. 131 | #html_use_smartypants = True 132 | 133 | # Custom sidebar templates, maps document names to template names. 134 | #html_sidebars = {} 135 | 136 | # Additional templates that should be rendered to pages, maps page names to 137 | # template names. 138 | #html_additional_pages = {} 139 | 140 | # If false, no module index is generated. 141 | #html_domain_indices = True 142 | 143 | # If false, no index is generated. 144 | #html_use_index = True 145 | 146 | # If true, the index is split into individual pages for each letter. 147 | #html_split_index = False 148 | 149 | # If true, links to the reST sources are added to the pages. 150 | #html_show_sourcelink = True 151 | 152 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 153 | #html_show_sphinx = True 154 | 155 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 156 | #html_show_copyright = True 157 | 158 | # If true, an OpenSearch description file will be output, and all pages will 159 | # contain a tag referring to it. The value of this option must be the 160 | # base URL from which the finished HTML is served. 161 | #html_use_opensearch = '' 162 | 163 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 164 | #html_file_suffix = None 165 | 166 | # Output file base name for HTML help builder. 167 | htmlhelp_basename = 'spacegridsdoc' 168 | 169 | 170 | # -- Options for LaTeX output -------------------------------------------------- 171 | 172 | latex_elements = { 173 | # The paper size ('letterpaper' or 'a4paper'). 174 | #'papersize': 'letterpaper', 175 | 176 | # The font size ('10pt', '11pt' or '12pt'). 177 | #'pointsize': '10pt', 178 | 179 | # Additional stuff for the LaTeX preamble. 180 | #'preamble': '', 181 | } 182 | 183 | # Grouping the document tree into LaTeX files. List of tuples 184 | # (source start file, target name, title, author, documentclass [howto/manual]). 185 | latex_documents = [ 186 | ('index', 'spacegrids.tex', u'spacegrids Documentation', 187 | u'Willem Sijp', 'manual'), 188 | ] 189 | 190 | # The name of an image file (relative to this directory) to place at the top of 191 | # the title page. 192 | #latex_logo = None 193 | 194 | # For "manual" documents, if this is true, then toplevel headings are parts, 195 | # not chapters. 196 | #latex_use_parts = False 197 | 198 | # If true, show page references after internal links. 199 | #latex_show_pagerefs = False 200 | 201 | # If true, show URL addresses after external links. 202 | #latex_show_urls = False 203 | 204 | # Documents to append as an appendix to all manuals. 205 | #latex_appendices = [] 206 | 207 | # If false, no module index is generated. 208 | #latex_domain_indices = True 209 | 210 | 211 | # -- Options for manual page output -------------------------------------------- 212 | 213 | # One entry per manual page. List of tuples 214 | # (source start file, name, description, authors, manual section). 215 | man_pages = [ 216 | ('index', 'spacegrids', u'spacegrids Documentation', 217 | [u'Willem Sijp'], 1) 218 | ] 219 | 220 | # If true, show URL addresses after external links. 221 | #man_show_urls = False 222 | 223 | 224 | # -- Options for Texinfo output ------------------------------------------------ 225 | 226 | # Grouping the document tree into Texinfo files. List of tuples 227 | # (source start file, target name, title, author, 228 | # dir menu entry, description, category) 229 | texinfo_documents = [ 230 | ('index', 'spacegrids', u'spacegrids Documentation', 231 | u'Willem Sijp', 'spacegrids', 'One line description of project.', 232 | 'Miscellaneous'), 233 | ] 234 | 235 | # Documents to append as an appendix to all manuals. 236 | #texinfo_appendices = [] 237 | 238 | # If false, no module index is generated. 239 | #texinfo_domain_indices = True 240 | 241 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 242 | #texinfo_show_urls = 'footnote' 243 | 244 | 245 | # -- Options for Epub output --------------------------------------------------- 246 | 247 | # Bibliographic Dublin Core info. 248 | epub_title = u'spacegrids' 249 | epub_author = u'Willem Sijp' 250 | epub_publisher = u'Willem Sijp' 251 | epub_copyright = u'2014, Willem Sijp' 252 | 253 | # The language of the text. It defaults to the language option 254 | # or en if the language is not set. 255 | #epub_language = '' 256 | 257 | # The scheme of the identifier. Typical schemes are ISBN or URL. 258 | #epub_scheme = '' 259 | 260 | # The unique identifier of the text. This can be a ISBN number 261 | # or the project homepage. 262 | #epub_identifier = '' 263 | 264 | # A unique identification for the text. 265 | #epub_uid = '' 266 | 267 | # A tuple containing the cover image and cover page html template filenames. 268 | #epub_cover = () 269 | 270 | # HTML files that should be inserted before the pages created by sphinx. 271 | # The format is a list of tuples containing the path and title. 272 | #epub_pre_files = [] 273 | 274 | # HTML files shat should be inserted after the pages created by sphinx. 275 | # The format is a list of tuples containing the path and title. 276 | #epub_post_files = [] 277 | 278 | # A list of files that should not be packed into the epub file. 279 | #epub_exclude_files = [] 280 | 281 | # The depth of the table of contents in toc.ncx. 282 | #epub_tocdepth = 3 283 | 284 | # Allow duplicate toc entries. 285 | #epub_tocdup = True 286 | -------------------------------------------------------------------------------- /docs/_build/html/_static/basic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * basic.css 3 | * ~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- basic theme. 6 | * 7 | * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /* -- main layout ----------------------------------------------------------- */ 13 | 14 | div.clearer { 15 | clear: both; 16 | } 17 | 18 | /* -- relbar ---------------------------------------------------------------- */ 19 | 20 | div.related { 21 | width: 100%; 22 | font-size: 90%; 23 | } 24 | 25 | div.related h3 { 26 | display: none; 27 | } 28 | 29 | div.related ul { 30 | margin: 0; 31 | padding: 0 0 0 10px; 32 | list-style: none; 33 | } 34 | 35 | div.related li { 36 | display: inline; 37 | } 38 | 39 | div.related li.right { 40 | float: right; 41 | margin-right: 5px; 42 | } 43 | 44 | /* -- sidebar --------------------------------------------------------------- */ 45 | 46 | div.sphinxsidebarwrapper { 47 | padding: 10px 5px 0 10px; 48 | } 49 | 50 | div.sphinxsidebar { 51 | float: left; 52 | width: 230px; 53 | margin-left: -100%; 54 | font-size: 90%; 55 | } 56 | 57 | div.sphinxsidebar ul { 58 | list-style: none; 59 | } 60 | 61 | div.sphinxsidebar ul ul, 62 | div.sphinxsidebar ul.want-points { 63 | margin-left: 20px; 64 | list-style: square; 65 | } 66 | 67 | div.sphinxsidebar ul ul { 68 | margin-top: 0; 69 | margin-bottom: 0; 70 | } 71 | 72 | div.sphinxsidebar form { 73 | margin-top: 10px; 74 | } 75 | 76 | div.sphinxsidebar input { 77 | border: 1px solid #98dbcc; 78 | font-family: sans-serif; 79 | font-size: 1em; 80 | } 81 | 82 | div.sphinxsidebar #searchbox input[type="text"] { 83 | width: 170px; 84 | } 85 | 86 | div.sphinxsidebar #searchbox input[type="submit"] { 87 | width: 30px; 88 | } 89 | 90 | img { 91 | border: 0; 92 | } 93 | 94 | /* -- search page ----------------------------------------------------------- */ 95 | 96 | ul.search { 97 | margin: 10px 0 0 20px; 98 | padding: 0; 99 | } 100 | 101 | ul.search li { 102 | padding: 5px 0 5px 20px; 103 | background-image: url(file.png); 104 | background-repeat: no-repeat; 105 | background-position: 0 7px; 106 | } 107 | 108 | ul.search li a { 109 | font-weight: bold; 110 | } 111 | 112 | ul.search li div.context { 113 | color: #888; 114 | margin: 2px 0 0 30px; 115 | text-align: left; 116 | } 117 | 118 | ul.keywordmatches li.goodmatch a { 119 | font-weight: bold; 120 | } 121 | 122 | /* -- index page ------------------------------------------------------------ */ 123 | 124 | table.contentstable { 125 | width: 90%; 126 | } 127 | 128 | table.contentstable p.biglink { 129 | line-height: 150%; 130 | } 131 | 132 | a.biglink { 133 | font-size: 1.3em; 134 | } 135 | 136 | span.linkdescr { 137 | font-style: italic; 138 | padding-top: 5px; 139 | font-size: 90%; 140 | } 141 | 142 | /* -- general index --------------------------------------------------------- */ 143 | 144 | table.indextable { 145 | width: 100%; 146 | } 147 | 148 | table.indextable td { 149 | text-align: left; 150 | vertical-align: top; 151 | } 152 | 153 | table.indextable dl, table.indextable dd { 154 | margin-top: 0; 155 | margin-bottom: 0; 156 | } 157 | 158 | table.indextable tr.pcap { 159 | height: 10px; 160 | } 161 | 162 | table.indextable tr.cap { 163 | margin-top: 10px; 164 | background-color: #f2f2f2; 165 | } 166 | 167 | img.toggler { 168 | margin-right: 3px; 169 | margin-top: 3px; 170 | cursor: pointer; 171 | } 172 | 173 | div.modindex-jumpbox { 174 | border-top: 1px solid #ddd; 175 | border-bottom: 1px solid #ddd; 176 | margin: 1em 0 1em 0; 177 | padding: 0.4em; 178 | } 179 | 180 | div.genindex-jumpbox { 181 | border-top: 1px solid #ddd; 182 | border-bottom: 1px solid #ddd; 183 | margin: 1em 0 1em 0; 184 | padding: 0.4em; 185 | } 186 | 187 | /* -- general body styles --------------------------------------------------- */ 188 | 189 | a.headerlink { 190 | visibility: hidden; 191 | } 192 | 193 | h1:hover > a.headerlink, 194 | h2:hover > a.headerlink, 195 | h3:hover > a.headerlink, 196 | h4:hover > a.headerlink, 197 | h5:hover > a.headerlink, 198 | h6:hover > a.headerlink, 199 | dt:hover > a.headerlink { 200 | visibility: visible; 201 | } 202 | 203 | div.body p.caption { 204 | text-align: inherit; 205 | } 206 | 207 | div.body td { 208 | text-align: left; 209 | } 210 | 211 | .field-list ul { 212 | padding-left: 1em; 213 | } 214 | 215 | .first { 216 | margin-top: 0 !important; 217 | } 218 | 219 | p.rubric { 220 | margin-top: 30px; 221 | font-weight: bold; 222 | } 223 | 224 | img.align-left, .figure.align-left, object.align-left { 225 | clear: left; 226 | float: left; 227 | margin-right: 1em; 228 | } 229 | 230 | img.align-right, .figure.align-right, object.align-right { 231 | clear: right; 232 | float: right; 233 | margin-left: 1em; 234 | } 235 | 236 | img.align-center, .figure.align-center, object.align-center { 237 | display: block; 238 | margin-left: auto; 239 | margin-right: auto; 240 | } 241 | 242 | .align-left { 243 | text-align: left; 244 | } 245 | 246 | .align-center { 247 | text-align: center; 248 | } 249 | 250 | .align-right { 251 | text-align: right; 252 | } 253 | 254 | /* -- sidebars -------------------------------------------------------------- */ 255 | 256 | div.sidebar { 257 | margin: 0 0 0.5em 1em; 258 | border: 1px solid #ddb; 259 | padding: 7px 7px 0 7px; 260 | background-color: #ffe; 261 | width: 40%; 262 | float: right; 263 | } 264 | 265 | p.sidebar-title { 266 | font-weight: bold; 267 | } 268 | 269 | /* -- topics ---------------------------------------------------------------- */ 270 | 271 | div.topic { 272 | border: 1px solid #ccc; 273 | padding: 7px 7px 0 7px; 274 | margin: 10px 0 10px 0; 275 | } 276 | 277 | p.topic-title { 278 | font-size: 1.1em; 279 | font-weight: bold; 280 | margin-top: 10px; 281 | } 282 | 283 | /* -- admonitions ----------------------------------------------------------- */ 284 | 285 | div.admonition { 286 | margin-top: 10px; 287 | margin-bottom: 10px; 288 | padding: 7px; 289 | } 290 | 291 | div.admonition dt { 292 | font-weight: bold; 293 | } 294 | 295 | div.admonition dl { 296 | margin-bottom: 0; 297 | } 298 | 299 | p.admonition-title { 300 | margin: 0px 10px 5px 0px; 301 | font-weight: bold; 302 | } 303 | 304 | div.body p.centered { 305 | text-align: center; 306 | margin-top: 25px; 307 | } 308 | 309 | /* -- tables ---------------------------------------------------------------- */ 310 | 311 | table.docutils { 312 | border: 0; 313 | border-collapse: collapse; 314 | } 315 | 316 | table.docutils td, table.docutils th { 317 | padding: 1px 8px 1px 5px; 318 | border-top: 0; 319 | border-left: 0; 320 | border-right: 0; 321 | border-bottom: 1px solid #aaa; 322 | } 323 | 324 | table.field-list td, table.field-list th { 325 | border: 0 !important; 326 | } 327 | 328 | table.footnote td, table.footnote th { 329 | border: 0 !important; 330 | } 331 | 332 | th { 333 | text-align: left; 334 | padding-right: 5px; 335 | } 336 | 337 | table.citation { 338 | border-left: solid 1px gray; 339 | margin-left: 1px; 340 | } 341 | 342 | table.citation td { 343 | border-bottom: none; 344 | } 345 | 346 | /* -- other body styles ----------------------------------------------------- */ 347 | 348 | ol.arabic { 349 | list-style: decimal; 350 | } 351 | 352 | ol.loweralpha { 353 | list-style: lower-alpha; 354 | } 355 | 356 | ol.upperalpha { 357 | list-style: upper-alpha; 358 | } 359 | 360 | ol.lowerroman { 361 | list-style: lower-roman; 362 | } 363 | 364 | ol.upperroman { 365 | list-style: upper-roman; 366 | } 367 | 368 | dl { 369 | margin-bottom: 15px; 370 | } 371 | 372 | dd p { 373 | margin-top: 0px; 374 | } 375 | 376 | dd ul, dd table { 377 | margin-bottom: 10px; 378 | } 379 | 380 | dd { 381 | margin-top: 3px; 382 | margin-bottom: 10px; 383 | margin-left: 30px; 384 | } 385 | 386 | dt:target, .highlighted { 387 | background-color: #fbe54e; 388 | } 389 | 390 | dl.glossary dt { 391 | font-weight: bold; 392 | font-size: 1.1em; 393 | } 394 | 395 | .field-list ul { 396 | margin: 0; 397 | padding-left: 1em; 398 | } 399 | 400 | .field-list p { 401 | margin: 0; 402 | } 403 | 404 | .refcount { 405 | color: #060; 406 | } 407 | 408 | .optional { 409 | font-size: 1.3em; 410 | } 411 | 412 | .versionmodified { 413 | font-style: italic; 414 | } 415 | 416 | .system-message { 417 | background-color: #fda; 418 | padding: 5px; 419 | border: 3px solid red; 420 | } 421 | 422 | .footnote:target { 423 | background-color: #ffa; 424 | } 425 | 426 | .line-block { 427 | display: block; 428 | margin-top: 1em; 429 | margin-bottom: 1em; 430 | } 431 | 432 | .line-block .line-block { 433 | margin-top: 0; 434 | margin-bottom: 0; 435 | margin-left: 1.5em; 436 | } 437 | 438 | .guilabel, .menuselection { 439 | font-family: sans-serif; 440 | } 441 | 442 | .accelerator { 443 | text-decoration: underline; 444 | } 445 | 446 | .classifier { 447 | font-style: oblique; 448 | } 449 | 450 | abbr, acronym { 451 | border-bottom: dotted 1px; 452 | cursor: help; 453 | } 454 | 455 | /* -- code displays --------------------------------------------------------- */ 456 | 457 | pre { 458 | overflow: auto; 459 | overflow-y: hidden; /* fixes display issues on Chrome browsers */ 460 | } 461 | 462 | td.linenos pre { 463 | padding: 5px 0px; 464 | border: 0; 465 | background-color: transparent; 466 | color: #aaa; 467 | } 468 | 469 | table.highlighttable { 470 | margin-left: 0.5em; 471 | } 472 | 473 | table.highlighttable td { 474 | padding: 0 0.5em 0 0.5em; 475 | } 476 | 477 | tt.descname { 478 | background-color: transparent; 479 | font-weight: bold; 480 | font-size: 1.2em; 481 | } 482 | 483 | tt.descclassname { 484 | background-color: transparent; 485 | } 486 | 487 | tt.xref, a tt { 488 | background-color: transparent; 489 | font-weight: bold; 490 | } 491 | 492 | h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { 493 | background-color: transparent; 494 | } 495 | 496 | .viewcode-link { 497 | float: right; 498 | } 499 | 500 | .viewcode-back { 501 | float: right; 502 | font-family: sans-serif; 503 | } 504 | 505 | div.viewcode-block:target { 506 | margin: -1px -10px; 507 | padding: 0 10px; 508 | } 509 | 510 | /* -- math display ---------------------------------------------------------- */ 511 | 512 | img.math { 513 | vertical-align: middle; 514 | } 515 | 516 | div.body div.math p { 517 | text-align: center; 518 | } 519 | 520 | span.eqno { 521 | float: right; 522 | } 523 | 524 | /* -- printout stylesheet --------------------------------------------------- */ 525 | 526 | @media print { 527 | div.document, 528 | div.documentwrapper, 529 | div.bodywrapper { 530 | margin: 0 !important; 531 | width: 100%; 532 | } 533 | 534 | div.sphinxsidebar, 535 | div.related, 536 | div.footer, 537 | #top-link { 538 | display: none; 539 | } 540 | } -------------------------------------------------------------------------------- /docs/_build/html/introduction.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Spacegrids — spacegrids documentation 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 51 | 52 |
53 |
54 |
55 |
56 | 57 |
58 |

Spacegrids

59 |

Spacegrids is an open source library providing a Numpy array with grids, labelled axes and associated grid-related mathematical methods such as regridding and integration. Spacegrids provides an object data model of Netcdf data that ensures consistency between a Numpy data array and its grid under common operations (and so avoiding common pitfalls related to axis interpretation), and much more. It is a write less do more library for everyday use.

60 |

These interactive plots from Netcdf data are based on Spacegrids.

61 |

The Field, Gr (grid) and Coord objects make everyday use easy:

62 |
>>> import spacegrids as sg
 63 | >>> D = sg.info(nonick = True)
 64 | >>> P = sgPproject(D['my_project'] , nonick = True)
 65 | >>> P.load(['temperature','u'])
 66 | >>> # obtain the axes objects under their names T,X,Y,Z:
 67 | >>> for c in P['some_experiment'].axes:
 68 | >>>   exec c.name + ' = c'  # now we can refer to X,Y
 69 | >>> TEMP = P['some_experiment']['temperature']
 70 | >>> U = P['some_experiment']['u'] # zonal velocity
 71 | >>> TEMP_sliced = TEMP[Y,:50] # slice. Note Y axis object
 72 | >>> m_TEMP = TEMP_sliced/(X*Y) # take hor. mean
 73 | >>> TEMP_regridded = TEMP.regrid(U.gr)  # U grid differs
 74 | 
75 |
76 |
77 |

Features

78 |
    79 |
  • A numpy array with grid allowing automatic alignment and dimension broadcasting
  • 80 |
  • Easy to use and intuitive regridding functionality
  • 81 |
  • A data object model corresponding closely to Netcdf
  • 82 |
  • Easier IO via abstraction of IO with multiple Netcdf files
  • 83 |
  • Makes working with output of many experiments easy via aggregation methods
  • 84 |
  • The Field class eliminates errors arising from picking the wrong array index
  • 85 |
  • Quicker plotting due to automatic labels, axes etc.
  • 86 |
  • Distance-related methods such as spatial differentiation and integration on sphere
  • 87 |
  • Extensive unit tests and documentation
  • 88 |
89 |

There is lots of documentation, both in the source code and elsewhere. Other documentation can be found at:

90 | 96 |
97 |
98 |

Installation

99 |

Install spacegrids simply by running (on command line):

100 |
101 |
pip install spacegrids
102 |

Dependencies: numpy, scipy, matplotlib (NetCDF4 optional). On Ubuntu/ Debian, install dependencies via package manager if pip install fails:

103 |
104 |
apt-get install python-{tk,numpy,matplotlib,scipy}
105 |

On Mac, pip can be installed via “sudo easy_install pip”.

106 |
107 |
108 |

Contribute

109 |
    110 |
  • Issue Tracker: github.com/willo12/spacegrids/issues
  • 111 |
  • Source Code: github.com/willo12/spacegrids
  • 112 |
113 |
114 |
115 |

Support

116 |

If you are having issues, please let us know.

117 |
118 |
119 |

License

120 |

The project is licensed under the BSD license.

121 |
122 |
123 |

Other Packages

124 |

A related promising package is dimarray. It considers dimension names as a fundamental property of an array, and as such supports netCDF I/O format. It makes use of it in binary operations (broadcasting), transforms and indexing. 125 | It includes some of the nice features of pandas (e.g. axis alignment, optional 126 | nan skipping) but extends them to N dimensions, with a behaviour closer 127 | to a numpy array. Some geo features are planned (weighted mean for latitude, 128 | indexing modulo 360 for longitude, basic regridding) but dimarray should remain broad in scope. Other packages are larry , pandas and iris.

129 |
130 |
131 | 132 | 133 |
134 |
135 |
136 |
137 |
138 |

Table Of Contents

139 | 150 | 151 |

Previous topic

152 |

Spacegrids data analysis documentation

154 |

Next topic

155 |

spacegrids Package

157 |

This Page

158 | 162 | 174 | 175 |
176 |
177 |
178 |
179 | 197 | 201 | 202 | -------------------------------------------------------------------------------- /docs/_build/html/searchindex.js: -------------------------------------------------------------------------------- 1 | Search.setIndex({objects:{"spacegrids.projectcls.Project":{load:[2,1,1,""],param2gr:[2,1,1,""],get:[2,1,1,""],show:[2,1,1,""],adexp:[2,1,1,""],cat:[2,1,1,""],write:[2,1,1,""],incdf:[2,1,1,""],ls:[2,1,1,""],insert:[2,1,1,""],loaded:[2,1,1,""],delvar:[2,1,1,""],ad_mask:[2,1,1,""],delexp:[2,1,1,""],pattern2gr:[2,1,1,""]},"spacegrids.fieldcls.Coord":{dist:[2,1,1,""],vol:[2,1,1,""],weaksame:[2,1,1,""],sliced:[2,1,1,""],cumsum:[2,1,1,""],sum:[2,1,1,""],same:[2,1,1,""],write:[2,1,1,""],roll:[2,1,1,""],finer:[2,1,1,""],sort:[2,1,1,""],trans:[2,1,1,""],d:[2,1,1,""],vcumsum:[2,1,1,""],der:[2,1,1,""],flip:[2,1,1,""],eq_index:[2,1,1,""],cast:[2,1,1,""],delta_dist:[2,1,1,""],give_axis:[2,1,1,""],start_zero:[2,1,1,""],give_dual:[2,1,1,""],vsum:[2,1,1,""],coord_shift:[2,1,1,""]},"spacegrids.fieldcls.VField":{draw:[2,1,1,""],vcumsum:[2,1,1,""],vsum_weighted:[2,1,1,""],der:[2,1,1,""],direction:[2,1,1,""],innersum:[2,1,1,""],vsum:[2,1,1,""]},"spacegrids.abstract.Membered":{copy:[2,1,1,""],eq_perm:[2,1,1,""],reverse:[2,1,1,""],get_from_members:[2,1,1,""],strict_equiv:[2,1,1,""],weaksame:[2,1,1,""],same:[2,1,1,""],eq_index:[2,1,1,""],rearrange:[2,1,1,""],json:[2,1,1,""],perm:[2,1,1,""],eq_in:[2,1,1,""],is_equiv:[2,1,1,""],call_on_members:[2,1,1,""]},"spacegrids.ops":{Slice:[2,3,1,""],FloatMul:[2,3,1,""],PickBasin:[2,3,1,""],Sum:[2,3,1,""],Add:[2,3,1,""],StrInAttr:[2,3,1,""],Mul:[2,3,1,""],Innprod:[2,3,1,""],Lazy:[2,3,1,""],LinScale:[2,3,1,""],Der:[2,3,1,""],Identity:[2,3,1,""],SetDirection:[2,3,1,""],make_lin_form:[2,2,1,""],Integ:[2,3,1,""],Try:[2,3,1,""],While:[2,3,1,""],FieldMul:[2,3,1,""],Pick:[2,3,1,""],Mean:[2,3,1,""],Prim:[2,3,1,""],Operator:[2,3,1,""],If:[2,3,1,""]},"spacegrids.abstract.Valued":{sliced:[2,1,1,""],get_value:[2,1,1,""],array_equal:[2,1,1,""],same:[2,1,1,""],set_value:[2,1,1,""]},spacegrids:{expercls:[2,0,1,""],projectcls:[2,0,1,""],ops:[2,0,1,""],fieldcls:[2,0,1,""],"abstract":[2,0,1,""],utilsg:[2,0,1,""],plotting:[2,0,1,""],"__init__":[2,0,1,""]},"spacegrids.fieldcls.Gr":{"function":[2,1,1,""],to_slices:[2,1,1,""],squeeze:[2,1,1,""],array_equal:[2,1,1,""],vol:[2,1,1,""],der:[2,1,1,""],sliced:[2,1,1,""],regrid:[2,1,1,""],shape:[2,1,1,""],ones:[2,1,1,""],nbytes:[2,1,1,""],dual:[2,1,1,""],mean:[2,1,1,""],inflate:[2,1,1,""],vsum:[2,1,1,""],expand:[2,1,1,""],axis:[2,1,1,""]},"spacegrids.utilsg.Report":{table:[2,1,1,""],line:[2,1,1,""],echoln:[2,1,1,""],block:[2,1,1,""],echo:[2,1,1,""]},"spacegrids.utilsg":{simple_glob:[2,2,1,""],end_of_filepath:[2,2,1,""],affix:[2,2,1,""],sublist:[2,2,1,""],floodfill:[2,2,1,""],move_north_maker:[2,2,1,""],add_alias:[2,2,1,""],parse_control_file:[2,2,1,""],move_west:[2,2,1,""],tocsv:[2,2,1,""],id_in:[2,2,1,""],move_east_maker:[2,2,1,""],round_order:[2,2,1,""],Report:[2,3,1,""],plural:[2,2,1,""],order_mag:[2,2,1,""],get_att:[2,2,1,""],read:[2,2,1,""],fromcsv:[2,2,1,""],rem_equivs:[2,2,1,""],tohtml:[2,2,1,""],move_south:[2,2,1,""],merge:[2,2,1,""],find_perm:[2,2,1,""],id_index:[2,2,1,""]},"spacegrids.fieldcls.Ax":{der:[2,1,1,""],vsum:[2,1,1,""],vcumsum:[2,1,1,""]},"spacegrids.expercls":{Exper:[2,3,1,""],isexpdir:[2,2,1,""]},"spacegrids.projectcls":{info:[2,2,1,""],Project:[2,3,1,""],overview:[2,2,1,""],parse_fname_func:[2,2,1,""],project:[2,3,1,""],read_projnick:[2,2,1,""],ls:[2,2,1,""],info_dict:[2,2,1,""],read_control_func:[2,2,1,""],avg_temp:[2,2,1,""]},"spacegrids.fieldcls":{unsqueeze:[2,2,1,""],finer_field:[2,2,1,""],finer_grid:[2,2,1,""],make_dual:[2,2,1,""],Field:[2,3,1,""],AxGr:[2,3,1,""],XCoord:[2,3,1,""],make_axes:[2,2,1,""],find_set_dual:[2,2,1,""],roll:[2,2,1,""],concatenate:[2,2,1,""],guess_direction:[2,2,1,""],Coord:[2,3,1,""],ones:[2,2,1,""],GetId:[2,3,1,""],delta:[2,2,1,""],squeeze:[2,2,1,""],Gr:[2,3,1,""],YCoord:[2,3,1,""],nugget:[2,2,1,""],cdfread:[2,2,1,""],interpret_slices:[2,2,1,""],cdfsniff:[2,2,1,""],VField:[2,3,1,""],Ax:[2,3,1,""],find_equal_axes:[2,2,1,""]},"spacegrids.fieldcls.XCoord":{dist:[2,1,1,""],d:[2,1,1,""],vol:[2,1,1,""],der:[2,1,1,""],coord_shift:[2,1,1,""],delta_dist:[2,1,1,""],roll:[2,1,1,""]},"spacegrids.expercls.Exper":{available:[2,1,1,""],insert:[2,1,1,""],list_vars:[2,1,1,""],get:[2,1,1,""],update_nbytes:[2,1,1,""],show:[2,1,1,""],load:[2,1,1,""],write:[2,1,1,""],ls:[2,1,1,""],available_long:[2,1,1,""],delvar:[2,1,1,""]},"spacegrids.abstract.Named":{weaksame:[2,1,1,""],samein:[2,1,1,""],same:[2,1,1,""],sameindex:[2,1,1,""],json:[2,1,1,""],copy:[2,1,1,""]},"spacegrids.abstract":{Membered:[2,3,1,""],Named:[2,3,1,""],Valued:[2,3,1,""],Associative:[2,3,1,""],Directional:[2,3,1,""]},"spacegrids.fieldcls.Field":{draw:[2,1,1,""],maskout:[2,1,1,""],vcumsum:[2,1,1,""],vsum_weighted:[2,1,1,""],mean:[2,1,1,""],der:[2,1,1,""],get_value:[2,1,1,""],transpose:[2,1,1,""],vol:[2,1,1,""],floodfill:[2,1,1,""],cat:[2,1,1,""],write:[2,1,1,""],regrid:[2,1,1,""],ones:[2,1,1,""],weaksame:[2,1,1,""],sum:[2,1,1,""],dV:[2,1,1,""],vsum:[2,1,1,""],roll:[2,1,1,""],slice_by:[2,1,1,""],set_value:[2,1,1,""]},"spacegrids.fieldcls.YCoord":{dist:[2,1,1,""]},"spacegrids.abstract.Directional":{eq_in:[2,1,1,""],eq_index:[2,1,1,""],make_equiv:[2,1,1,""],same:[2,1,1,""],is_equiv:[2,1,1,""]},"spacegrids.plotting":{contourf:[2,2,1,""],treat_kmt:[2,2,1,""],quiver:[2,2,1,""],plot:[2,2,1,""],auto_cont:[2,2,1,""],add_kmt:[2,2,1,""],contour:[2,2,1,""]}},terms:{all:[0,2],code:[0,2],dist:2,edg:2,groundwork:2,true_op:2,particular:2,"__and__":2,interchang:2,new_list:2,scalar:2,netcdf:[0,2],follow:2,"_merg":2,disk:2,row:2,contourf:2,content:[1,2],object:[0,2],depend:[0,2],arithmat:2,elsewher:0,friendli:2,raw_str:2,init:2,tracker:0,present:2,preliminari:[],skip:0,aris:0,hor_desc_col:2,latitude_edg:2,sourc:[0,2],everi:[],string:2,without:2,fals:2,could:2,releg:2,none:2,nbviewer:[],sublist:2,util:2,ident:2,mechan:2,innprod:2,veri:2,affect:2,name_att:2,delexp:2,induct:2,tri:2,dim:2,boundary_valu:2,distret:2,level:2,to_slic:2,overid:2,list:2,iter:2,new_coord_nam:2,item:2,vector:2,quick:2,round:2,dir:2,dimens:[0,2],quicker:0,ppm:2,netcdf4:0,"10m":2,natur:2,inconsist:2,multiplic:2,direct:[1,2],sign:2,"_scale_prep_deco":2,second:2,accomod:2,types_allow:2,pass:2,further:2,cat:2,panda:0,append:2,even:2,index:[0,1,2],what:2,appear:2,compar:2,cast:2,preserv:[],neg:2,sum:2,bathymetri:2,brief:2,cell:2,delet:2,version:2,run:0,"new":2,method:[0,2],contrast:2,metadata:2,value_typ:2,elimin:[0,2],full:2,objectd:2,deriv:2,get_from_memb:2,join:2,gener:2,ylbl:2,matplotlib:[0,2],behaviour:[0,2],let:0,info_dict:2,ubuntu:0,path:2,coincid:2,vertic:2,modifi:2,zero_kelvin:2,interpret:[0,2],nillpot:2,search:[1,2],relat:[0,2],ahead:2,shift:2,larger:2,give_axi:2,fld:2,projnam:2,find_equal_ax:2,behav:2,projectcl:[1,2],overriden:2,chang:2,magnitud:2,land_nan:2,control:2,via:[0,2],shorthand:2,extra:2,else_op:2,appli:2,modul:[1,2],willo12:0,apt:0,filenam:2,"boolean":2,uniqu:2,instal:[0,1],total:2,establish:2,select:2,plot:[0,1,2],from:[0,2],describ:2,ycoord:2,memori:2,curvelinear:2,depth:2,regist:2,two:2,perm:2,"_slice":2,append_last:2,call:2,recommend:2,taken:2,scope:0,row_delin:2,type:2,tell:2,more:[0,2],sort:2,desir:2,projdirnam:2,ylabel:2,enhanc:[],warn:2,flag:2,exce:2,latitude_sl:2,indic:[1,2],examin:2,keepgrid:2,known:2,set_valu:2,cach:2,must:2,account:2,word:2,make_ax:2,restor:2,alia:2,der:2,work:[0,2],"_cdfsniff_help":2,samein:2,magnif:2,histori:2,transpos:2,remain:[0,2],itself:2,del:2,can:[0,2],fnmatch:2,under:[0,2],vsum:2,fetch:2,sgpproject:[0,2],overrid:2,att_list:2,weaker:2,quiver:2,give:2,process:2,auxhiliari:2,sudo:0,expercl:[1,2],echoln:2,sphere:[0,2],critic:2,abort:2,want:2,xmin:2,eq_in:2,made:2,occur:2,gca:2,counterpart:2,differenti:[0,2],avg:2,multipl:[0,2],classs:2,iform:2,filepath:2,anoth:2,ordinari:2,parse_fname_func:2,att:2,decreas:2,write:[0,2],how:2,vfield:2,consist:[0,2],subdirectori:2,instead:2,nonick:[0,2],csv:2,simpl:2,updat:2,product:2,overridden:2,singular:2,max:2,after:2,surfac:2,reflect:2,befor:2,mac:0,mai:2,end:2,associ:[0,1,2],l_all:2,physic:2,fromcsv:2,south_index:2,sat1:2,sat2:2,github:0,attempt:2,practic:[0,2],tutori:0,read:2,mask_filt:2,correspond:[0,2],assign:2,issu:[0,2],inform:2,"switch":2,preced:2,combin:2,spheric:2,allow:[0,2],volum:2,o_temp:2,squeeze_field:2,delvar:2,order:2,end_of_filepath:2,origin:2,constitu:2,composit:2,help:2,mom2:2,over:2,top:2,utilsg:[1,2],becaus:2,meter:2,msk_val:2,increas:2,rem_char:2,through:2,same:2,left:2,"_dir_nam":2,mainli:2,strict_equiv:2,paramet:2,fir:2,cntrl_2200p:2,style:2,make_du:2,group:2,directli:2,binari:0,chosen:2,move_north_mak:2,fix:2,better:2,rem_equiv:2,table_tag:2,meridion:2,m_new:2,gr1:2,hor:[0,2],isurfac:2,main:2,might:2,easier:0,finer:2,eastward:2,non:2,scipi:0,"return":2,order_mag:2,thei:2,python:[0,2],safe:2,initi:2,mention:2,promis:0,zero_boundari:2,placehold:2,introduct:[],choic:2,term:2,name:[0,1,2],nugget:2,cdfread:2,tran:2,name_suffix:2,xcoord1_edg:2,iff:2,val:2,strinattr:2,each:2,found:[0,2],greyshad:2,tracer:2,mean:[0,2],subset:2,domain:2,pick_val:2,weight:[0,2],rexexp:2,replac:2,individu:2,hard:2,check_equiv:[],temp_regrid:0,procedur:2,wrap:2,expect:2,extract:2,orient:2,special:2,out:2,variabl:2,"try":2,ax_unit:2,matrix:2,space:2,goe:2,newli:2,latitude2:2,"0xab1550c":[],profil:2,path_par:2,col_dat:2,op_fctn:2,rel:2,kelvin:2,print:2,rstack:2,merg:2,plural:2,correct:2,integr:[0,2],linear:2,insid:2,workflow:2,subgrid:2,runtimeerror:2,differ:[0,2],standard:2,small:[],test_project:2,base:[0,2],"_which_att":2,xcoord:2,dictionari:2,xt_edg:2,"byte":2,force_squeez:2,upon:2,blob:[],card:2,care:2,topleft:2,tohtml:2,wai:2,veloc:[0,2],num_ytick:2,advanc:0,keep:2,filter:2,thing:2,length:2,latitudin:2,organis:2,slice_obj:2,outsid:2,geometri:2,databas:2,ojbect:2,onto:2,coord_shift:2,first:2,oper:[0,2],pleas:0,list_var:2,suffix:2,obviou:2,cstack:2,carri:2,onc:2,arrai:[0,2],independ:2,"__getitem__":2,number:2,thereof:2,echo:2,restrict:2,date:2,unlik:2,alreadi:2,done:2,messag:2,mask:2,xscale:2,oppos:2,open:[0,2],xcoord1:2,given:2,smaller:2,script:2,data:[0,1,2],interact:[0,2],as_int:2,"0xb84e24c":[],system:2,construct:2,innersum:2,cumul:2,master:[],too:2,directional_nam:2,similarli:2,parnam:2,conveni:2,expnam:2,store:2,inner:2,shell:2,floatmul:2,option:[0,2],relationship:2,namespac:2,copi:2,fld_name:2,stress:2,specifi:2,x_coord:[],broadcast:[0,2],o_sal:2,pars:2,squeezed_dim:2,somewhat:2,essenti:2,bigfield_dp:2,than:2,read_control_func:2,kind:2,keyword:2,cyclic:2,provid:[0,2],remov:2,tree:2,structur:2,horizont:2,project:[0,2],xlabel:2,str:2,were:2,posit:2,arrang:2,stricter:2,grei:2,seri:2,latitud:[0,2],"function":[0,2],sai:2,comput:2,pickbasin:2,uvic2:2,sometim:2,delim:2,argument:2,raw:2,width:2,ddx:2,have:[0,2],exper:2,need:2,eq_perm:2,element:2,"20m":2,sat:2,"_cat":2,built:2,id_in:2,alias:2,self:2,expos:2,m_temp:0,note:[0,2],also:2,delta_dist:2,build:2,fname:2,text:2,prepar:2,singl:2,ipynb:[],begin:2,regard:2,unless:2,shade:2,principl:2,multipli:2,glob:2,licens:[0,1],downard:2,x_dir_nam:2,most:2,param_nam:2,plan:0,bsd:0,"class":[0,2],sub:2,don:2,filesystem:2,fld0:2,later:2,stronger:2,some_experi:[0,2],doe:2,which:2,bracket:2,avg_temp:2,place:2,determin:2,round_ord:2,evaul:2,effect:2,axi:[0,2],ad_mask:2,fact:2,data_start_col:2,cdf:2,tke:2,prim:2,fieldcl:[1,2],fld1:2,show:2,opposit:2,affix:2,momentum_flux:2,radiu:2,bring:2,zt_edg:2,unchang:2,minus_z:2,earth:2,trivial:2,find:2,varnam:2,despit:2,onli:2,locat:2,"true":[0,2],configur:2,figur:2,should:[0,2],y_coord:2,add_kmt:2,dict:2,sub_dir:2,factor:2,"__call__":2,arang:2,sat_combin:2,overwritten:2,count:2,contribut:[0,1],ax_stack:2,get:[0,2],fail_val:2,convert:2,express:2,getid:2,call_on_memb:2,joint:2,cannot:2,mul:2,report:2,wise:2,recalcul:2,geo:0,isexpdir:2,requir:2,layout:2,showland:2,find_set_du:2,think:2,experi:[0,2],bar:2,temp_slic:0,organ:2,emb:2,irrevers:2,add_alia:2,hello:2,yield:2,"default":2,standard_nam:2,feed:2,dpc:2,common:[0,2],crd:2,contain:2,dpo:2,test1_edg:2,where:2,gr2:2,summari:2,conform:2,set:2,modulo:[0,2],dump:2,method2memb:[],qty:2,datatyp:2,see:2,result:2,arg:2,fail:[0,2],close:[0,2],charact:2,retriev:[],contour:2,closer:0,co2:2,extend:[0,2],pattern:2,someth:2,rootdir:2,label:[0,2],iri:0,insert_du:2,subdir:2,id_index:2,between:[0,2],flip:2,"import":[0,2],equiv:2,across:2,attribut:2,altern:2,available_long:2,accord:2,spacegrid:[0,1,2],kei:2,get_att:2,tup:2,filematch:2,screen:2,weak:2,o_temp_sl:2,aggreg:0,"8_t":2,sl_coord:2,here:2,extent:2,otherwis:2,solv:[],msk_grid:2,addit:2,verbos:2,satisfi:2,last:2,delimit:2,extens:[0,2],region:2,lazi:2,against:2,len:2,etc:[0,2],instanc:2,coord_stack:2,context:2,find_perm:2,slice_du:2,z_dir_nam:2,com:0,col:2,delimin:2,give_du:2,among:2,simpli:0,lev:2,point:2,within:2,overview:[0,2],x_cyclic:2,ipython:2,permut:2,axgr:[1,2],littl:2,ioerror:2,wider:2,respect:2,assum:2,along:2,speak:2,entrant:2,becom:2,z3049637:2,compos:2,though:2,grax:2,numpi:[0,2],due:[0,2],been:2,make_equiv:2,compon:2,json:2,much:[0,2],valu:[1,2],ocean:2,futur:2,valueerror:2,depric:2,legaci:2,versa:2,usag:2,both:[0,2],presenc:2,accordingli:2,data_start_row:2,slice_bi:2,ani:2,ridden:2,coordin:2,togeth:2,func:2,child:2,coord1_edg:2,"0xba0290c":[],those:2,land:2,"case":2,"__repr__":2,therefor:2,look:2,packag:[0,1,2],auxiliari:2,align:0,properti:[0,2],rearrang:2,row_head:2,colorbar:2,defin:2,calcul:2,incdf:2,momentum:2,abov:2,error:[0,2],wild:2,separ:2,start_zero:2,howev:2,simple_glob:2,max_tri:2,finer_field:2,update_nbyt:2,helper:2,stdout:2,vol:2,tabl:[1,2],henc:2,everydai:0,equal:2,believ:2,kwarg:2,grammat:2,dual:2,rid:2,zonal:[0,2],"__init__":2,parent:2,decor:2,inventori:2,"0xb2393ac":[],perform:2,netcdf_fil:2,make:[0,2],belong:2,a_sat:2,who:2,"while":2,member:[1,2],regrid:[0,2],html:2,uphys:2,antideriv:2,document:[0,1,2],complet:2,vfld:2,http:[],ddxddy:2,expans:2,pick:[0,2],wherea:2,"0xac65eec":[],inflat:2,piec:2,driven:[],lstack:2,rais:2,user:2,auto_cont:2,ycoord1:2,stack:2,expand:2,guess_direct:2,lower:2,appropri:2,t_dir_nam:2,equival:2,scenario:2,choos:2,entri:2,knowledg:2,well:2,get_valu:2,inherit:2,eq_index:2,unsqueez:2,exampl:2,command:0,"___call___":2,thi:2,interpol:2,model:[0,2],num_cont:2,dimension:2,slice_suffix:2,usual:2,test1:2,treat_kmt:2,test3:2,test2:2,identifi:2,just:2,less:[0,2],make_lin_form:2,nan:[0,2],weaksam:2,chk_load:2,exclud:2,obtain:[0,2],rest:2,shape:2,coord_nam:2,outlin:2,nicknam:2,yet:2,interpret_slic:2,cdf_var:2,now:[0,2],tocsv:2,easi:[0,2],finer_grid:2,had:2,except:2,shortcut:2,cdfsniff:2,floodfil:2,add:2,valid:2,coord3:2,coord2:2,coord1:2,primit:2,input:2,save:2,arrgument:2,wim:[],match:2,take:[0,2],real:2,around:2,format:[0,2],nan_val:2,testx:2,caller:2,load:[0,2],intuit:0,strict_v:2,yt_coord:2,temperatur:[0,2],grid:[0,2],xmax:2,mom:2,insert:2,testi:2,bit:2,tick:2,my_project:[0,2],apart:2,averag:2,like:2,specif:2,header:2,request:2,integ:2,northward:2,collect:2,sameindex:2,href:[],array_equ:2,either:2,view:2,output:[0,2],page:1,refin:2,encount:2,revers:2,salin:2,often:2,concat:2,interv:2,creation:2,some:[0,2],back:2,new_ax_nam:2,intern:2,contin:2,name_filt:2,mirror:2,proper:2,home:2,guess:2,librari:0,distribut:2,tmp:2,basic:[0,2],xlbl:2,ymin:2,flux:2,implement:2,lead:2,vsum_weight:2,broad:0,avoid:0,exec:[0,2],definit:2,achiev:2,per:2,fieldmul:2,wrong:0,when:2,kmt:2,unit:[0,2],recognis:2,condit:2,foo:2,file_extens:2,refer:[0,2],plt:2,success:2,new_coord:2,inspect:2,subspac:2,adexp:2,uvic:2,add2cstack:2,great:2,squeez:2,although:2,boundari:2,regexp:2,linscal:2,subtract:2,fulli:2,cond_op:2,comparison:2,about:2,checktemp:2,rare:2,would:2,know:0,column:2,slightli:2,manag:0,maxlen:2,degre:2,regular:2,act:2,"0xb37c96c":[],approxim:2,upward:2,disabl:2,gamma:2,setdirect:2,own:2,slice:[0,2],"float":2,tag:2,easy_instal:0,automat:[0,2],dataset:2,pair:2,right:2,empti:2,vcumsum:2,ensur:0,side:2,pitfal:0,your:2,"0xb1671ec":[],nbyte:2,guess_append:2,van:2,ymax:2,suffici:2,area:2,transfer:[],support:[0,1],rotat:2,transform:[0,2],"long":2,custom:[],avail:2,start:2,adjac:2,interfac:2,includ:[0,2],lot:0,unequ:2,"var":2,"0xa6e91ec":[],strictli:2,strict:2,entir:2,treat:2,analysi:1,head:2,larri:0,north:2,form:2,longitudin:2,forc:2,tupl:2,long_nam:2,idea:2,msg:2,pwd:2,state:2,link:2,measur:2,att_nam:2,y_dir_nam:2,line:[0,2],y_step:2,cumsum:2,info:[0,2],concaten:2,param2gr:2,move_south:2,move_east_mak:2,attr:2,temp:[0,2],possibl:2,whether:2,notat:2,att2memb:[],access:2,displai:2,record:2,mani:[0,2],limit:2,kelvin2c:2,fundament:[0,2],step:2,problem:2,similar:2,is_equiv:2,block:2,weakli:2,featur:[0,1],constant:2,alongsid:2,creat:2,yscale:2,"int":2,certain:2,"abstract":[0,1,2],repres:2,"char":2,exist:2,file:[0,2],pip:0,same_index:2,quantiti:2,read_projnick:2,check:2,fill:2,distanc:[0,2],coord:[0,1,2],equat:2,descr:2,mask_val:2,obj:2,mathemat:[0,2],hybrid:2,detail:2,reduct:2,field:[0,1,2],old:2,other:[0,1,2],parse_control_fil:2,normal:2,spatial:[0,2],test:[0,2],"0xb711aec":[],you:0,roll:2,nice:0,node:2,polar:2,draw:2,repeat:2,intend:2,wildcard:2,them:[0,2],actual:2,sequenc:2,org:[],nomatch_fil:2,ddy:2,ndarrai:2,multidimension:2,move_west:2,scale:2,pattern2gr:2,consid:[0,2],nanval:2,param:2,debian:0,longitud:[0,2],"0x3d86d50":2,reduc:2,maskout:2,handl:2,longer:2,testx_edg:2,vice:2,directori:2,nparrai:2,descript:2,num_xtick:2,rule:2,dimarrai:0,moment:2,delta:2,ignor:2,y_cyclic:2,time:2,tranpos:2,latitude3:2},objtypes:{"0":"py:module","1":"py:method","2":"py:function","3":"py:class"},titles:["Spacegrids","Spacegrids data analysis documentation","spacegrids Package"],objnames:{"0":["py","module","Python module"],"1":["py","method","Python method"],"2":["py","function","Python function"],"3":["py","class","Python class"]},filenames:["introduction","index","spacegrids"]}) -------------------------------------------------------------------------------- /docs/_build/html/_static/searchtools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * searchtools.js_t 3 | * ~~~~~~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilties for the full-text search. 6 | * 7 | * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /** 13 | * helper function to return a node containing the 14 | * search summary for a given text. keywords is a list 15 | * of stemmed words, hlwords is the list of normal, unstemmed 16 | * words. the first one is used to find the occurance, the 17 | * latter for highlighting it. 18 | */ 19 | 20 | jQuery.makeSearchSummary = function(text, keywords, hlwords) { 21 | var textLower = text.toLowerCase(); 22 | var start = 0; 23 | $.each(keywords, function() { 24 | var i = textLower.indexOf(this.toLowerCase()); 25 | if (i > -1) 26 | start = i; 27 | }); 28 | start = Math.max(start - 120, 0); 29 | var excerpt = ((start > 0) ? '...' : '') + 30 | $.trim(text.substr(start, 240)) + 31 | ((start + 240 - text.length) ? '...' : ''); 32 | var rv = $('
').text(excerpt); 33 | $.each(hlwords, function() { 34 | rv = rv.highlightText(this, 'highlighted'); 35 | }); 36 | return rv; 37 | } 38 | 39 | 40 | /** 41 | * Porter Stemmer 42 | */ 43 | var Stemmer = function() { 44 | 45 | var step2list = { 46 | ational: 'ate', 47 | tional: 'tion', 48 | enci: 'ence', 49 | anci: 'ance', 50 | izer: 'ize', 51 | bli: 'ble', 52 | alli: 'al', 53 | entli: 'ent', 54 | eli: 'e', 55 | ousli: 'ous', 56 | ization: 'ize', 57 | ation: 'ate', 58 | ator: 'ate', 59 | alism: 'al', 60 | iveness: 'ive', 61 | fulness: 'ful', 62 | ousness: 'ous', 63 | aliti: 'al', 64 | iviti: 'ive', 65 | biliti: 'ble', 66 | logi: 'log' 67 | }; 68 | 69 | var step3list = { 70 | icate: 'ic', 71 | ative: '', 72 | alize: 'al', 73 | iciti: 'ic', 74 | ical: 'ic', 75 | ful: '', 76 | ness: '' 77 | }; 78 | 79 | var c = "[^aeiou]"; // consonant 80 | var v = "[aeiouy]"; // vowel 81 | var C = c + "[^aeiouy]*"; // consonant sequence 82 | var V = v + "[aeiou]*"; // vowel sequence 83 | 84 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 85 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 86 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 87 | var s_v = "^(" + C + ")?" + v; // vowel in stem 88 | 89 | this.stemWord = function (w) { 90 | var stem; 91 | var suffix; 92 | var firstch; 93 | var origword = w; 94 | 95 | if (w.length < 3) 96 | return w; 97 | 98 | var re; 99 | var re2; 100 | var re3; 101 | var re4; 102 | 103 | firstch = w.substr(0,1); 104 | if (firstch == "y") 105 | w = firstch.toUpperCase() + w.substr(1); 106 | 107 | // Step 1a 108 | re = /^(.+?)(ss|i)es$/; 109 | re2 = /^(.+?)([^s])s$/; 110 | 111 | if (re.test(w)) 112 | w = w.replace(re,"$1$2"); 113 | else if (re2.test(w)) 114 | w = w.replace(re2,"$1$2"); 115 | 116 | // Step 1b 117 | re = /^(.+?)eed$/; 118 | re2 = /^(.+?)(ed|ing)$/; 119 | if (re.test(w)) { 120 | var fp = re.exec(w); 121 | re = new RegExp(mgr0); 122 | if (re.test(fp[1])) { 123 | re = /.$/; 124 | w = w.replace(re,""); 125 | } 126 | } 127 | else if (re2.test(w)) { 128 | var fp = re2.exec(w); 129 | stem = fp[1]; 130 | re2 = new RegExp(s_v); 131 | if (re2.test(stem)) { 132 | w = stem; 133 | re2 = /(at|bl|iz)$/; 134 | re3 = new RegExp("([^aeiouylsz])\\1$"); 135 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 136 | if (re2.test(w)) 137 | w = w + "e"; 138 | else if (re3.test(w)) { 139 | re = /.$/; 140 | w = w.replace(re,""); 141 | } 142 | else if (re4.test(w)) 143 | w = w + "e"; 144 | } 145 | } 146 | 147 | // Step 1c 148 | re = /^(.+?)y$/; 149 | if (re.test(w)) { 150 | var fp = re.exec(w); 151 | stem = fp[1]; 152 | re = new RegExp(s_v); 153 | if (re.test(stem)) 154 | w = stem + "i"; 155 | } 156 | 157 | // Step 2 158 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 159 | if (re.test(w)) { 160 | var fp = re.exec(w); 161 | stem = fp[1]; 162 | suffix = fp[2]; 163 | re = new RegExp(mgr0); 164 | if (re.test(stem)) 165 | w = stem + step2list[suffix]; 166 | } 167 | 168 | // Step 3 169 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 170 | if (re.test(w)) { 171 | var fp = re.exec(w); 172 | stem = fp[1]; 173 | suffix = fp[2]; 174 | re = new RegExp(mgr0); 175 | if (re.test(stem)) 176 | w = stem + step3list[suffix]; 177 | } 178 | 179 | // Step 4 180 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 181 | re2 = /^(.+?)(s|t)(ion)$/; 182 | if (re.test(w)) { 183 | var fp = re.exec(w); 184 | stem = fp[1]; 185 | re = new RegExp(mgr1); 186 | if (re.test(stem)) 187 | w = stem; 188 | } 189 | else if (re2.test(w)) { 190 | var fp = re2.exec(w); 191 | stem = fp[1] + fp[2]; 192 | re2 = new RegExp(mgr1); 193 | if (re2.test(stem)) 194 | w = stem; 195 | } 196 | 197 | // Step 5 198 | re = /^(.+?)e$/; 199 | if (re.test(w)) { 200 | var fp = re.exec(w); 201 | stem = fp[1]; 202 | re = new RegExp(mgr1); 203 | re2 = new RegExp(meq1); 204 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 205 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) 206 | w = stem; 207 | } 208 | re = /ll$/; 209 | re2 = new RegExp(mgr1); 210 | if (re.test(w) && re2.test(w)) { 211 | re = /.$/; 212 | w = w.replace(re,""); 213 | } 214 | 215 | // and turn initial Y back to y 216 | if (firstch == "y") 217 | w = firstch.toLowerCase() + w.substr(1); 218 | return w; 219 | } 220 | } 221 | 222 | 223 | /** 224 | * Search Module 225 | */ 226 | var Search = { 227 | 228 | _index : null, 229 | _queued_query : null, 230 | _pulse_status : -1, 231 | 232 | init : function() { 233 | var params = $.getQueryParameters(); 234 | if (params.q) { 235 | var query = params.q[0]; 236 | $('input[name="q"]')[0].value = query; 237 | this.performSearch(query); 238 | } 239 | }, 240 | 241 | loadIndex : function(url) { 242 | $.ajax({type: "GET", url: url, data: null, success: null, 243 | dataType: "script", cache: true}); 244 | }, 245 | 246 | setIndex : function(index) { 247 | var q; 248 | this._index = index; 249 | if ((q = this._queued_query) !== null) { 250 | this._queued_query = null; 251 | Search.query(q); 252 | } 253 | }, 254 | 255 | hasIndex : function() { 256 | return this._index !== null; 257 | }, 258 | 259 | deferQuery : function(query) { 260 | this._queued_query = query; 261 | }, 262 | 263 | stopPulse : function() { 264 | this._pulse_status = 0; 265 | }, 266 | 267 | startPulse : function() { 268 | if (this._pulse_status >= 0) 269 | return; 270 | function pulse() { 271 | Search._pulse_status = (Search._pulse_status + 1) % 4; 272 | var dotString = ''; 273 | for (var i = 0; i < Search._pulse_status; i++) 274 | dotString += '.'; 275 | Search.dots.text(dotString); 276 | if (Search._pulse_status > -1) 277 | window.setTimeout(pulse, 500); 278 | }; 279 | pulse(); 280 | }, 281 | 282 | /** 283 | * perform a search for something 284 | */ 285 | performSearch : function(query) { 286 | // create the required interface elements 287 | this.out = $('#search-results'); 288 | this.title = $('

' + _('Searching') + '

').appendTo(this.out); 289 | this.dots = $('').appendTo(this.title); 290 | this.status = $('

').appendTo(this.out); 291 | this.output = $('