[Numpy-discussion] numpy scalars and savez -- bug?

Chris Barker - NOAA Federal chris.barker at noaa.gov
Thu Apr 18 11:50:11 EDT 2013


On Thu, Apr 18, 2013 at 8:31 AM, Chris Barker - NOAA Federal
<chris.barker at noaa.gov> wrote:

> Fair enough -- so a missing feature, not bug -- I'll need to look at
> the docs and see if that can be clarified -

All I've found is the docstring docs (which also show up in the Sphinx
docs). I suggest some slight modification:

def save(file, arr):
    """
    Save an array to a binary file in NumPy ``.npy`` format.

    Parameters
    ----------
    file : file or str
        File or filename to which the data is saved.  If file is a file-object,
        then the filename is unchanged.  If file is a string, a ``.npy``
        extension will be appended to the file name if it does not already
        have one.
    arr : array_like
        Array data to be saved. Any object that is not an array will be
        converted to an array with asanyarray(). When reloaded, the array
        version of the object will be returned.

    See Also
    --------
    savez : Save several arrays into a ``.npz`` archive
    savetxt, load

    Notes
    -----
    For a description of the ``.npy`` format, see `format`.

    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()

    >>> x = np.arange(10)
    >>> np.save(outfile, x)

    >>> outfile.seek(0) # Only needed here to simulate closing & reopening file
    >>> np.load(outfile)
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    """

I also see:

For a description of the ``.npy`` format, see `format`.

but no idea where to find 'format' -- it looks like it should be a
link in the Sphinx docs, but it's not.

-Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the NumPy-Discussion mailing list