dimarray


Namedimarray JSON
Version 1.2 PyPI version JSON
download
home_page
Summarynumpy array with labelled dimensions and axes, dimension, NaN handling and netCDF I/O
upload_time2023-03-20 10:38:17
maintainer
docs_urlhttps://pythonhosted.org/dimarray/
author
requires_python>=3.7
licenseBSD-3-Clause
keywords labelled array numpy larry pandas
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Introduction
============

.. image:: https://travis-ci.org/perrette/dimarray.svg?branch=master
   :target: https://travis-ci.org/perrette/dimarray

Numpy array with dimensions
---------------------------
dimarray is a package to handle numpy arrays with labelled dimensions and axes. 
Inspired from pandas, it includes advanced alignment and reshaping features and 
as well as missing-value (NaN) handling.

The main difference with pandas is that it is generalized to N dimensions, and behaves more closely to a numpy array. 
The axes do not have fixed names ('index', 'columns', etc...) but are 
given a meaningful name by the user (e.g. 'time', 'items', 'lon' ...). 
This is especially useful for high dimensional problems such as sensitivity analyses.

A natural I/O format for such an array is netCDF, common in geophysics, which relies on 
the netCDF4 package, and supports metadata.


License
-------
dimarray is distributed under a 3-clause ("Simplified" or "New") BSD
license. Parts of basemap which have BSD compatible licenses are included.
See the LICENSE file, which is distributed with the dimarray package, for details.

Getting started
---------------

A **``DimArray``** can be defined just like a numpy array, with
additional information about its dimensions, which can be provided
via its `axes` and `dims` parameters:

>>> from dimarray import DimArray
>>> a = DimArray([[1.,2,3], [4,5,6]], axes=[['a', 'b'], [1950, 1960, 1970]], dims=['variable', 'time']) 
>>> a
dimarray: 6 non-null elements (0 null)
0 / variable (2): 'a' to 'b'
1 / time (3): 1950 to 1970
array([[1., 2., 3.],
       [4., 5., 6.]])

Indexing now works on axes

>>> a['b', 1970]
6.0

Or can just be done **a la numpy**, via integer index:

>>> a.ix[0, -1]
3.0

Basic numpy transformations are also in there:

>>> a.mean(axis='time')
dimarray: 2 non-null elements (0 null)
0 / variable (2): 'a' to 'b'
array([2., 5.])

Can export to `pandas` for pretty printing:

>>> a.to_pandas()
time      1950  1960  1970
variable                  
a          1.0   2.0   3.0
b          4.0   5.0   6.0


.. _links:

Useful links
------------
================================    ====================================
Documentation                       http://dimarray.readthedocs.org
Code on github (bleeding edge)      https://github.com/perrette/dimarray
Code on pypi   (releases)           https://pypi.python.org/pypi/dimarray
Issues Tracker                      https://github.com/perrette/dimarray/issues
================================    ====================================

Install
-------

**Requirements**:

- python >= 2.7, 3
- numpy (tested with 1.7, 1.8, 1.9, 1.10.1, 1.15)

**Optional**:

- netCDF4 (tested with 1.0.8, 1.2.1) (netCDF archiving) (see notes below)
- matplotlib 1.1 (plotting)
- pandas 0.11 (interface with pandas)

Download the latest version from github and extract from archive
Then from the dimarray repository type (possibly preceded by sudo):

.. code:: bash
    
    python setup.py install  

Alternatively, you can use pip to download and install the version from pypi (could be slightly out-of-date):

.. code:: bash

    pip install dimarray 


Notes on installing netCDF4
^^^^^^^^^^^^^^^^^^^^^^^^^^^
- On Ubuntu, using apt-get is the easiest way (as indicated at https://github.com/Unidata/netcdf4-python/blob/master/.travis.yml):


.. code:: bash

   sudo apt-get install libhdf5-serial-dev netcdf-bin libnetcdf-dev

- On windows binaries are available: http://www.unidata.ucar.edu/software/netcdf/docs/winbin.html

- From source. Installing the netCDF4 python module from source can be cumbersome, because 
  it depends on netCDF4 and (especially) HDF5 C libraries that need to 
  be compiled with specific flags (http://unidata.github.io/netcdf4-python). 
  Detailled information on Ubuntu: https://code.google.com/p/netcdf4-python/wiki/UbuntuInstall


Contributions
-------------
All suggestions for improvement or direct contributions are very welcome.
You can open an `issue` on github for specific requests.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "dimarray",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/dimarray/",
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "labelled array,numpy,larry,pandas",
    "author": "",
    "author_email": "Mah\u00e9 Perrette <mahe.perrette@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/9d/9f/41425ad21bc6203cf71de165ef4276a763745e443f45988fcc5ed3b1ed1e/dimarray-1.2.tar.gz",
    "platform": null,
    "description": "Introduction\n============\n\n.. image:: https://travis-ci.org/perrette/dimarray.svg?branch=master\n   :target: https://travis-ci.org/perrette/dimarray\n\nNumpy array with dimensions\n---------------------------\ndimarray is a package to handle numpy arrays with labelled dimensions and axes. \nInspired from pandas, it includes advanced alignment and reshaping features and \nas well as missing-value (NaN) handling.\n\nThe main difference with pandas is that it is generalized to N dimensions, and behaves more closely to a numpy array. \nThe axes do not have fixed names ('index', 'columns', etc...) but are \ngiven a meaningful name by the user (e.g. 'time', 'items', 'lon' ...). \nThis is especially useful for high dimensional problems such as sensitivity analyses.\n\nA natural I/O format for such an array is netCDF, common in geophysics, which relies on \nthe netCDF4 package, and supports metadata.\n\n\nLicense\n-------\ndimarray is distributed under a 3-clause (\"Simplified\" or \"New\") BSD\nlicense. Parts of basemap which have BSD compatible licenses are included.\nSee the LICENSE file, which is distributed with the dimarray package, for details.\n\nGetting started\n---------------\n\nA **``DimArray``** can be defined just like a numpy array, with\nadditional information about its dimensions, which can be provided\nvia its `axes` and `dims` parameters:\n\n>>> from dimarray import DimArray\n>>> a = DimArray([[1.,2,3], [4,5,6]], axes=[['a', 'b'], [1950, 1960, 1970]], dims=['variable', 'time']) \n>>> a\ndimarray: 6 non-null elements (0 null)\n0 / variable (2): 'a' to 'b'\n1 / time (3): 1950 to 1970\narray([[1., 2., 3.],\n       [4., 5., 6.]])\n\nIndexing now works on axes\n\n>>> a['b', 1970]\n6.0\n\nOr can just be done **a la numpy**, via integer index:\n\n>>> a.ix[0, -1]\n3.0\n\nBasic numpy transformations are also in there:\n\n>>> a.mean(axis='time')\ndimarray: 2 non-null elements (0 null)\n0 / variable (2): 'a' to 'b'\narray([2., 5.])\n\nCan export to `pandas` for pretty printing:\n\n>>> a.to_pandas()\ntime      1950  1960  1970\nvariable                  \na          1.0   2.0   3.0\nb          4.0   5.0   6.0\n\n\n.. _links:\n\nUseful links\n------------\n================================    ====================================\nDocumentation                       http://dimarray.readthedocs.org\nCode on github (bleeding edge)      https://github.com/perrette/dimarray\nCode on pypi   (releases)           https://pypi.python.org/pypi/dimarray\nIssues Tracker                      https://github.com/perrette/dimarray/issues\n================================    ====================================\n\nInstall\n-------\n\n**Requirements**:\n\n- python >= 2.7, 3\n- numpy (tested with 1.7, 1.8, 1.9, 1.10.1, 1.15)\n\n**Optional**:\n\n- netCDF4 (tested with 1.0.8, 1.2.1) (netCDF archiving) (see notes below)\n- matplotlib 1.1 (plotting)\n- pandas 0.11 (interface with pandas)\n\nDownload the latest version from github and extract from archive\nThen from the dimarray repository type (possibly preceded by sudo):\n\n.. code:: bash\n    \n    python setup.py install  \n\nAlternatively, you can use pip to download and install the version from pypi (could be slightly out-of-date):\n\n.. code:: bash\n\n    pip install dimarray \n\n\nNotes on installing netCDF4\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n- On Ubuntu, using apt-get is the easiest way (as indicated at https://github.com/Unidata/netcdf4-python/blob/master/.travis.yml):\n\n\n.. code:: bash\n\n   sudo apt-get install libhdf5-serial-dev netcdf-bin libnetcdf-dev\n\n- On windows binaries are available: http://www.unidata.ucar.edu/software/netcdf/docs/winbin.html\n\n- From source. Installing the netCDF4 python module from source can be cumbersome, because \n  it depends on netCDF4 and (especially) HDF5 C libraries that need to \n  be compiled with specific flags (http://unidata.github.io/netcdf4-python). \n  Detailled information on Ubuntu: https://code.google.com/p/netcdf4-python/wiki/UbuntuInstall\n\n\nContributions\n-------------\nAll suggestions for improvement or direct contributions are very welcome.\nYou can open an `issue` on github for specific requests.\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "numpy array with labelled dimensions and axes, dimension, NaN handling and netCDF I/O",
    "version": "1.2",
    "split_keywords": [
        "labelled array",
        "numpy",
        "larry",
        "pandas"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b3df7a01c3d4ab198ca9ec35d85b96124ddf479d49c245c1a8c6922f710411e3",
                "md5": "9576af7effdad22a8c9704c3553f6091",
                "sha256": "0cc36e08075c809673148c7ad0924e8dbe8a34185fdab136bbfa075bdff3d689"
            },
            "downloads": -1,
            "filename": "dimarray-1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9576af7effdad22a8c9704c3553f6091",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 258284,
            "upload_time": "2023-03-20T10:38:15",
            "upload_time_iso_8601": "2023-03-20T10:38:15.514910Z",
            "url": "https://files.pythonhosted.org/packages/b3/df/7a01c3d4ab198ca9ec35d85b96124ddf479d49c245c1a8c6922f710411e3/dimarray-1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d9f41425ad21bc6203cf71de165ef4276a763745e443f45988fcc5ed3b1ed1e",
                "md5": "c34c052f7b939830213ed19c61a59b97",
                "sha256": "883c01086515ac02ede2ae88f3bede08495ff0c8d7709a22f15e560afd6f7595"
            },
            "downloads": -1,
            "filename": "dimarray-1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c34c052f7b939830213ed19c61a59b97",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 674794,
            "upload_time": "2023-03-20T10:38:17",
            "upload_time_iso_8601": "2023-03-20T10:38:17.702139Z",
            "url": "https://files.pythonhosted.org/packages/9d/9f/41425ad21bc6203cf71de165ef4276a763745e443f45988fcc5ed3b1ed1e/dimarray-1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-20 10:38:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "dimarray"
}
        
Elapsed time: 0.06293s