Source code for pyjams.readnetcdf
+ Source code for pyjams.ncinfo
#!/usr/bin/env python
"""
-Get variables from or print information of a netcdf file
+Information on a netcdf file
This module was written by Matthias Cuntz while at Department of
Computational Hydrosystems, Helmholtz Centre for Environmental
@@ -40,7 +41,7 @@ Source code for pyjams.readnetcdf
National de Recherche pour l'Agriculture, l'Alimentation et
l'Environnement (INRAE), Nancy, France.
-:copyright: Copyright 2009-2022 Matthias Cuntz, Stephan Thober, see AUTHORS.rst for details.
+:copyright: Copyright 2009-2023 Matthias Cuntz, Stephan Thober, see AUTHORS.rst for details.
:license: MIT License, see LICENSE for details.
.. moduleauthor:: Matthias Cuntz
@@ -48,42 +49,29 @@ Source code for pyjams.readnetcdf
The following functions are provided
.. autosummary::
- infonetcdf
ncinfo
- readnetcdf
- ncread
+ infonetcdf
History
- * Written Jul 2009 by
- Matthias Cuntz (mc (at) macu (dot) de)
- * Removed quiet keyword, Jun 2012, Matthias Cuntz
- * Ported to Python 3, Feb 2013, Matthias Cuntz
- * Wrapper functions netcdfread, ncread, readnc, Oct 2013, Matthias Cuntz
- * overwrite keyword, Apr 2014, Stephan Thober
- * dims keyword, May 2014, Stephan Thober
- * attributes keyword, Jun 2016, Stephan Thober
- * Restrict overwrite to files with only one variables,
- Aug 2016, Stephan Thober
- * Do not count dimension variables in variable count for overwrite,
- Oct 2016, Matthias Cuntz
- * Remove wrappers netcdfread and readnc, Mar 2022, Matthias Cuntz
- * Remove reform keyword, Mar 2022, Matthias Cuntz
- * Put all info abilities into separate routine infonetcdf
- with wrapper function ncinfo, Mar 2022, Matthias Cuntz
+ * Written Mar 2022 from ncread by moving all info abilities into separate
+ routine infonetcdf with wrapper function ncinfo, Mar 2022, Matthias Cuntz
* Invert functions and wrapper functions, Feb 2023, Matthias Cuntz
+ * Move ncinfo in separate file, Nov 2023, Matthias Cuntz
+ * sort=True default, Nov 2023, Matthias Cuntz
+ * Enforce keywords after var, Nov 2023, Matthias Cuntz
"""
-__all__ = ['infonetcdf', 'ncinfo',
- 'readnetcdf', 'ncread']
+__all__ = ['ncinfo', 'infonetcdf']
-[docs]def ncinfo(ncfile,
- var='', code=-1, dims=False, shape=False, attributes=False,
+[docs]def ncinfo(ncfile,
+ var='', *, code=-1,
variables=False, codes=False,
long_names=False, units=False,
- sort=False):
+ dims=False, shape=False, attributes=False,
+ sort=True):
"""
Get information on variables in a netcdf file
@@ -98,15 +86,6 @@ Source code for pyjams.readnetcdf
Variable code such as in files coming from GRIB,
only relevant if *dims* or *attributes* are True.
*var* takes precedence over *code*.
- dims : bool, optional
- Get tuple of dimension names for the variable with name *var*
- or number *code*.
- shape : bool, optional
- Get shape of the variable with name *var* or number *code*.
- attributes : bool, optional
- Get dictionary of all attributes of variable with name *var* or number
- *code*, or all file attributes of *ncfile* if *var* and *code* are not
- given
variables : bool, optional
Get list of variables in *ncfile*
codes : bool, optional
@@ -118,9 +97,18 @@ Source code for pyjams.readnetcdf
units : bool, optional
Get list of variable attributes *units*.
Missing units will be filled with ''.
+ dims : bool, optional
+ Get tuple of dimension names for the variable with name *var*
+ or number *code*.
+ shape : bool, optional
+ Get shape of the variable with name *var* or number *code*.
+ attributes : bool, optional
+ Get dictionary of all attributes of variable with name *var* or number
+ *code*, or all file attributes of *ncfile* if *var* and *code* are not
+ given
sort : bool, optional
- Sort output of *variables*, *codes*, *units*, and *long_names*
- with variable name as the sort key
+ If True (default), sort output of *variables*, *codes*, *units*,
+ and *long_names* with variable name as the sort key
Returns
-------
@@ -135,7 +123,7 @@ Source code for pyjams.readnetcdf
Get variable names
- >>> ncfile = 'test_readnetcdf.nc'
+ >>> ncfile = 'test_ncread.nc'
>>> print([ str(i) for i in ncinfo(ncfile, variables=True) ])
['x', 'y', 'is1', 'is2']
>>> print([ str(i)
@@ -145,20 +133,19 @@ Source code for pyjams.readnetcdf
Get codes
>>> print(ncinfo(ncfile, codes=True))
- [-1, -1, 128, 129]
+ [128, 129, -1, -1]
>>> print(ncinfo(ncfile, codes=True, sort=True))
[128, 129, -1, -1]
+ >>> print(ncinfo(ncfile, codes=True, sort=False))
+ [-1, -1, 128, 129]
Get special attributes units and long_names
>>> print([ str(i) for i in ncinfo(ncfile, units=True) ])
- ['xx', 'yy', 'arbitrary', 'arbitrary']
- >>> print([ str(i) for i in ncinfo(ncfile, units=True, sort=True) ])
['arbitrary', 'arbitrary', 'xx', 'yy']
+ >>> print([ str(i) for i in ncinfo(ncfile, units=True, sort=False) ])
+ ['xx', 'yy', 'arbitrary', 'arbitrary']
>>> print([ str(i) for i in ncinfo(ncfile, long_names=True) ])
- ['x-axis', 'y-axis', 'all ones', 'all twos']
- >>> print([ str(i)
- ... for i in ncinfo(ncfile, long_names=True, sort=True) ])
['all ones', 'all twos', 'x-axis', 'y-axis']
Get dims
@@ -168,12 +155,12 @@ Source code for pyjams.readnetcdf
Get shape
- >>> print(ncinfo(ncfile, var='is1', shape=True))
+ >>> print(ncinfo(ncfile, 'is1', shape=True))
(2, 4)
Get attributes
- >>> t1 = ncinfo(ncfile, var='is1', attributes=True)
+ >>> t1 = ncinfo(ncfile, 'is1', attributes=True)
>>> print([ str(i) for i in sorted(t1) ])
['code', 'long_name', 'units']
@@ -203,7 +190,7 @@ Source code for pyjams.readnetcdf
# code
if codes:
- cods = [-1]*nvars
+ cods = [-1] * nvars
for i, v in enumerate(svars):
attr = f.variables[v].ncattrs()
if 'code' in attr:
@@ -328,134 +315,13 @@ Source code for pyjams.readnetcdf
return
-[docs]def infonetcdf(*args, **kwargs):
+[docs]def infonetcdf(*args, **kwargs):
"""
Wrapper for :func:`ncinfo`
"""
return ncinfo(*args, **kwargs)
-[docs]def ncread(ncfile, var='', code=-1, squeeze=False,
- pointer=False, overwrite=False):
- """
- Gets variables of a netcdf file
-
- Parameters
- ----------
- ncfile : str
- netCDF file name
- variables : bool, optional
- Get list of variables in *ncfile*
- codes : bool, optional
- Get list of variable attributes *code*
- Missing codes will be filled with -1.
- squeeze : bool, optional
- Squeeze output array, i.e. remove dimensions of size 1.
- pointer : bool, optional
- Return pointers to the open file and to the variable if True,
- i.e. without actually reading the variable.
- The file will be open in read-only 'r' mode.
- *overwrite* precedes over *pointer*.
- overwrite : bool, optional
- Return pointers to the open file and to the variable if True,
- where the file is opened in append 'a' mode allowing to modify
- the variable. ``ncread`` allows *overwrite* only if the file
- contains a single variable (without the dimension variables).
- *overwrite* precedes over *pointer*.
-
- Returns
- -------
- numpy array of the variable with name *var* or number *code*, or
- (file pointer, variable pointer)
-
-
- Examples
- --------
-
- Read variable or code
-
- >>> ncfile = 'test_readnetcdf.nc'
- >>> print(ncread(ncfile, var='is1'))
- [[1. 1. 1. 1.]
- [1. 1. 1. 1.]]
- >>> print(ncread(ncfile, code=129))
- [[2. 2. 2. 2.]
- [2. 2. 2. 2.]]
-
- Just get file handle so that read is done later at indexing
- useful for example to inquire remote netcdf files first
-
- >>> fh, var = ncread(ncfile, var='is1', pointer=True)
- >>> print(var.shape)
- (2, 4)
- >>> print(var[:])
- [[1. 1. 1. 1.]
- [1. 1. 1. 1.]]
- >>> fh.close()
-
- Change a variable in a file
-
- >>> ncfile = 'test_readnetcdf1.nc'
- >>> print(ncread(ncfile, var='is1'))
- [[1. 1. 1. 1.]
- [1. 1. 1. 1.]]
- >>> fh, var = ncread(ncfile, var='is1', overwrite=True)
- >>> var[:] *= 2.
- >>> fh.close()
- >>> print(ncread(ncfile, var='is1'))
- [[2. 2. 2. 2.]
- [2. 2. 2. 2.]]
- >>> fh, var = ncread(ncfile, var='is1', overwrite=True)
- >>> var[:] *= 0.5
- >>> fh.close()
-
- """
- import netCDF4 as nc
-
- if (not var) and (code == -1):
- raise ValueError('var or code has to be given.')
-
- vvars = ncinfo(ncfile, variables=True)
- if var:
- if var not in vvars:
- raise ValueError(f'Variable {var} not in file {ncfile}.')
- else:
- cods = ncinfo(ncfile, codes=True)
- if code not in cods:
- raise ValueError(f'Code {code} not in file {ncfile}.')
- var = vvars[cods.index(code)]
-
- fmode = 'r'
- if overwrite:
- fmode = 'a'
- # check that only one variable
- dims = ncinfo(ncfile, var=var, dims=True)
- vvars1 = [ v for v in vvars if v not in dims ]
- if len(vvars1) > 1:
- raise ValueError('overwrite is only allowed on files with a single'
- ' variable (without dimension variables).')
-
- f = nc.Dataset(ncfile, fmode)
- v = f.variables[var]
-
- if pointer or overwrite:
- return f, v
-
- v = v[:]
- if squeeze:
- v = v.squeeze()
-
- f.close()
- return v
-
-
-[docs]def readnetcdf(*args, **kwargs):
- """
- Wrapper for :func:`ncread`
- """
- return ncread(*args, **kwargs)
-
-
if __name__ == '__main__':
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)
@@ -527,7 +393,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/ncio/netcdfio.html b/docs/html/_modules/pyjams/ncio/netcdfio.html
index 6d26e57..9ee5d02 100644
--- a/docs/html/_modules/pyjams/ncio/netcdfio.html
+++ b/docs/html/_modules/pyjams/ncio/netcdfio.html
@@ -1,10 +1,11 @@
+
- pyjams.ncio.netcdfio — pyjams 1.33.dev11 documentation
+ pyjams.ncio.netcdfio — pyjams 1.33 documentation
@@ -73,6 +74,10 @@ Source code for pyjams.ncio.netcdfio
* Delete unnecessary HDF5 filters in variable definition for compatibility
with netcdf4 > 1.6.0, Jun 2022, Matthias Cuntz
* Make get_variable_definition public, Apr 2023, Matthias Cuntz
+ * get_variable_definition returns _FillValue and only then missing_value,
+ Jul 2023, Matthias Cuntz
+ * create_variables sets missing_value attribute if present even if used for
+ _FillValue, Jul 2023, Matthias Cuntz
"""
import numpy as np
@@ -156,10 +161,10 @@ Source code for pyjams.ncio.netcdfio
if not isinstance(ncvar.chunking(), str):
chunks = list(ncvar.chunking())
# missing value
- if "missing_value" in dir(ncvar):
- ifill = ncvar.missing_value
- elif "_FillValue" in dir(ncvar):
+ if "_FillValue" in dir(ncvar):
ifill = ncvar._FillValue
+ elif "missing_value" in dir(ncvar):
+ ifill = ncvar.missing_value
else:
ifill = None
# output variable
@@ -551,7 +556,7 @@ Source code for pyjams.ncio.netcdfio
_ = ncdict.pop('chunksizes')
if 'fill_value' not in ncdict:
ncdict.update({'fill_value': None})
- # set missing value if None
+ # set _FillValue if None
if ncdict['fill_value'] is None:
if fill:
if isinstance(fill, bool):
@@ -684,7 +689,7 @@ Source code for pyjams.ncio.netcdfio
chunks = chunks[:ip] + rchunk + chunks[ip+1:]
invardef['dimensions'] = dims
invardef['chunksizes'] = chunks
- # set missing value if None
+ # set _FillValue if None
if invardef['fill_value'] is None:
if fill:
if isinstance(fill, bool):
@@ -700,7 +705,7 @@ Source code for pyjams.ncio.netcdfio
ovar = fo.createVariable(oname, otype, **invardef)
for k in ivar.ncattrs():
iattr = ivar.getncattr(k)
- if (k != 'missing_value') and (k != '_FillValue'):
+ if k != '_FillValue':
ovar.setncattr(k, iattr)
return
@@ -853,7 +858,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/ncread.html b/docs/html/_modules/pyjams/ncread.html
new file mode 100644
index 0000000..b659641
--- /dev/null
+++ b/docs/html/_modules/pyjams/ncread.html
@@ -0,0 +1,284 @@
+
+
+
+
+
+
+
+ pyjams.ncread — pyjams 1.33 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source code for pyjams.ncread
+#!/usr/bin/env python
+"""
+Get variables from netcdf file
+
+This module was written by Matthias Cuntz while at Department of
+Computational Hydrosystems, Helmholtz Centre for Environmental
+Research - UFZ, Leipzig, Germany, and continued while at Institut
+National de Recherche pour l'Agriculture, l'Alimentation et
+l'Environnement (INRAE), Nancy, France.
+
+:copyright: Copyright 2009-2023 Matthias Cuntz, Stephan Thober, see AUTHORS.rst for details.
+:license: MIT License, see LICENSE for details.
+
+.. moduleauthor:: Matthias Cuntz
+
+The following functions are provided
+
+.. autosummary::
+ ncread
+ readnetcdf
+
+History
+ * Written Jul 2009 by
+ Matthias Cuntz (mc (at) macu (dot) de)
+ * Removed quiet keyword, Jun 2012, Matthias Cuntz
+ * Ported to Python 3, Feb 2013, Matthias Cuntz
+ * Wrapper functions netcdfread, ncread, readnc, Oct 2013, Matthias Cuntz
+ * overwrite keyword, Apr 2014, Stephan Thober
+ * dims keyword, May 2014, Stephan Thober
+ * attributes keyword, Jun 2016, Stephan Thober
+ * Restrict overwrite to files with only one variables,
+ Aug 2016, Stephan Thober
+ * Do not count dimension variables in variable count for overwrite,
+ Oct 2016, Matthias Cuntz
+ * Remove wrappers netcdfread and readnc, Mar 2022, Matthias Cuntz
+ * Remove reform keyword, Mar 2022, Matthias Cuntz
+ * Put all info abilities into separate routine infonetcdf
+ with wrapper function ncinfo, Mar 2022, Matthias Cuntz
+ * Invert functions and wrapper functions, Feb 2023, Matthias Cuntz
+ * Rename file to ncread, Nov 2023, Matthias Cuntz
+ * Move ncinfo in separate file, Nov 2023, Matthias Cuntz
+
+"""
+from .ncinfo import ncinfo
+
+
+__all__ = ['ncread', 'readnetcdf']
+
+
+[docs]def ncread(ncfile, var='', code=-1, squeeze=False,
+ pointer=False, overwrite=False):
+ """
+ Gets variables of a netcdf file
+
+ Parameters
+ ----------
+ ncfile : str
+ netCDF file name
+ variables : bool, optional
+ Get list of variables in *ncfile*
+ codes : bool, optional
+ Get list of variable attributes *code*
+ Missing codes will be filled with -1.
+ squeeze : bool, optional
+ Squeeze output array, i.e. remove dimensions of size 1.
+ pointer : bool, optional
+ Return pointers to the open file and to the variable if True,
+ i.e. without actually reading the variable.
+ The file will be open in read-only 'r' mode.
+ *overwrite* precedes over *pointer*.
+ overwrite : bool, optional
+ Return pointers to the open file and to the variable if True,
+ where the file is opened in append 'a' mode allowing to modify
+ the variable. ``ncread`` allows *overwrite* only if the file
+ contains a single variable (without the dimension variables).
+ *overwrite* precedes over *pointer*.
+
+ Returns
+ -------
+ numpy array of the variable with name *var* or number *code*, or
+ (file pointer, variable pointer)
+
+
+ Examples
+ --------
+
+ Read variable or code
+
+ >>> ncfile = 'test_ncread.nc'
+ >>> print(ncread(ncfile, var='is1'))
+ [[1. 1. 1. 1.]
+ [1. 1. 1. 1.]]
+ >>> print(ncread(ncfile, code=129))
+ [[2. 2. 2. 2.]
+ [2. 2. 2. 2.]]
+
+ Just get file handle so that read is done later at indexing
+ useful for example to inquire remote netcdf files first
+
+ >>> fh, var = ncread(ncfile, var='is1', pointer=True)
+ >>> print(var.shape)
+ (2, 4)
+ >>> print(var[:])
+ [[1. 1. 1. 1.]
+ [1. 1. 1. 1.]]
+ >>> fh.close()
+
+ Change a variable in a file
+
+ >>> ncfile = 'test_ncread1.nc'
+ >>> print(ncread(ncfile, var='is1'))
+ [[1. 1. 1. 1.]
+ [1. 1. 1. 1.]]
+ >>> fh, var = ncread(ncfile, var='is1', overwrite=True)
+ >>> var[:] *= 2.
+ >>> fh.close()
+ >>> print(ncread(ncfile, var='is1'))
+ [[2. 2. 2. 2.]
+ [2. 2. 2. 2.]]
+ >>> fh, var = ncread(ncfile, var='is1', overwrite=True)
+ >>> var[:] *= 0.5
+ >>> fh.close()
+
+ """
+ import netCDF4 as nc
+
+ if (not var) and (code == -1):
+ raise ValueError('var or code has to be given.')
+
+ vvars = ncinfo(ncfile, variables=True)
+ if var:
+ if var not in vvars:
+ raise ValueError(f'Variable {var} not in file {ncfile}.')
+ else:
+ cods = ncinfo(ncfile, codes=True)
+ if code not in cods:
+ raise ValueError(f'Code {code} not in file {ncfile}.')
+ var = vvars[cods.index(code)]
+
+ fmode = 'r'
+ if overwrite:
+ fmode = 'a'
+ # check that only one variable
+ dims = ncinfo(ncfile, var=var, dims=True)
+ vvars1 = [ v for v in vvars if v not in dims ]
+ if len(vvars1) > 1:
+ raise ValueError('overwrite is only allowed on files with a single'
+ ' variable (without dimension variables).')
+
+ f = nc.Dataset(ncfile, fmode)
+ v = f.variables[var]
+
+ if pointer or overwrite:
+ return f, v
+
+ v = v[:]
+ if squeeze:
+ v = v.squeeze()
+
+ f.close()
+ return v
+
+
+[docs]def readnetcdf(*args, **kwargs):
+ """
+ Wrapper for :func:`ncread`
+ """
+ return ncread(*args, **kwargs)
+
+
+if __name__ == '__main__':
+ import doctest
+ doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/html/_modules/pyjams/npyio.html b/docs/html/_modules/pyjams/npyio.html
index fcd6b66..66f64c7 100644
--- a/docs/html/_modules/pyjams/npyio.html
+++ b/docs/html/_modules/pyjams/npyio.html
@@ -1,10 +1,11 @@
+
- pyjams.npyio — pyjams 1.33.dev11 documentation
+ pyjams.npyio — pyjams 1.33 documentation
@@ -450,7 +451,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/pack.html b/docs/html/_modules/pyjams/pack.html
index 6ef83b3..1eb1fdc 100644
--- a/docs/html/_modules/pyjams/pack.html
+++ b/docs/html/_modules/pyjams/pack.html
@@ -1,10 +1,11 @@
+
- pyjams.pack — pyjams 1.33.dev11 documentation
+ pyjams.pack — pyjams 1.33 documentation
@@ -60,6 +61,7 @@ Source code for pyjams.pack
* Rename value keyword to fill_value as in numpy masked arrays,
May 2023, Matthias Cuntz
* Assert output type equals input type, May 2023, Matthias Cuntz
+ * Use np.full instead of np.ones * fill_value, Jul 2023, Matthias Cuntz
"""
import numpy as np
@@ -180,7 +182,8 @@ Source code for pyjams.pack
Unpacks the last dimension into several dimensions under a mask.
The unpacked elements will be set to a user-defined fill_value.
- The mask can have any number of dimensions up to the array dimensions.
+
+ The array can have any number of dimensions up to the mask dimensions.
Parameters
----------
@@ -299,7 +302,7 @@ Source code for pyjams.pack
# Flat output array
array1d = np.ravel(array)
- arraynd = np.ones(icount, dtype=array.dtype) * fill_value
+ arraynd = np.full(icount, fill_value, dtype=array.dtype)
arraynd[ii] = array1d[:]
# Reshaped output array
@@ -382,7 +385,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/position.html b/docs/html/_modules/pyjams/position.html
index 69b6b84..3f93f4c 100644
--- a/docs/html/_modules/pyjams/position.html
+++ b/docs/html/_modules/pyjams/position.html
@@ -1,10 +1,11 @@
+
- pyjams.position — pyjams 1.33.dev11 documentation
+ pyjams.position — pyjams 1.33 documentation
@@ -335,7 +336,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/romanliterals.html b/docs/html/_modules/pyjams/romanliterals.html
index a841e6b..3c93190 100644
--- a/docs/html/_modules/pyjams/romanliterals.html
+++ b/docs/html/_modules/pyjams/romanliterals.html
@@ -1,10 +1,11 @@
+
- pyjams.romanliterals — pyjams 1.33.dev11 documentation
+ pyjams.romanliterals — pyjams 1.33 documentation
@@ -241,7 +242,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/sce.html b/docs/html/_modules/pyjams/sce.html
index 55d3eb1..574f0ba 100644
--- a/docs/html/_modules/pyjams/sce.html
+++ b/docs/html/_modules/pyjams/sce.html
@@ -1,10 +1,11 @@
+
- pyjams.sce — pyjams 1.33.dev11 documentation
+ pyjams.sce — pyjams 1.33 documentation
@@ -32,7 +33,7 @@
Source code for pyjams.sce
#!/usr/bin/env python
"""
-Shuffled-Complex-Evolution (SCE) algorithm for function minimization
+The Shuffled Complex Evolution (SCE) global optimizer
This code is based on a Fortran program of Qingyun Duan (2004), ported to
Python by Stijn Van Hoey (2011). It was taken up, debugged, enhanced and is
@@ -110,6 +111,11 @@ Source code for pyjams.sce
* Warn only if lb > ub, simply set mask if lb == ub,
May 2023, Matthias Cuntz
* Exit if initial population failed twice, May 2023, Matthias Cuntz
+ * random_sample(1)[0] to assure scalar, Jul 2023, Matthias Cuntz
+ * call_func method to assure scalar output,
+ Jul 2023, Matthias Cuntz
+ * Require keyword names after mask, Jul 2023, Matthias Cuntz
+ * Set maxn to N*log(N) formula per default, Sep 2023, Matthias Cuntz
"""
import warnings
@@ -118,8 +124,6 @@ Source code for pyjams.sce
from scipy._lib._util import check_random_state
from scipy.optimize._constraints import Bounds
-# ToDo:
-# - write tmp/population files (of Fortran code)
__all__ = ['sce']
@@ -182,10 +186,10 @@ Source code for pyjams.sce
[docs]def sce(func, x0, lb, ub=None,
- mask=None,
+ mask=None, *,
args=(), kwargs={},
sampling='half-open',
- maxn=1000, kstop=10, pcento=0.0001, peps=0.001,
+ maxn=0, kstop=10, pcento=0.0001, peps=0.001,
ngs=2, npg=0, nps=0, nspl=0, mings=0,
seed=None, iniflg=True,
alpha=0.8, beta=0.45, maxit=False, printit=2,
@@ -193,14 +197,17 @@ Source code for pyjams.sce
restart=False, restartfile1='',
restartfile2=''):
"""
- Shuffled-Complex-Evolution algorithm for function minimization
+ Shuffled Complex Evolution algorithm for finding the minimum of a
+ multivariate function
- The SCE or SCE-UA method is a general purpose global optimization.
+ The SCE or SCE-UA method is a general purpose global optimization, which
+ can be used with high-dimensional problems. It was used successfully,
+ for example, to calibrate hydrologic models with more than 50 parameters
+ [5]_.
The algorithm has been described in detail in Duan et al. [1]_ and [2]_.
Another paper of Duan et al. [3]_ discusses how to use the method
- effectively.
- This implementation also includes the recommendations of Behrangi et al.
- [4]_.
+ effectively. The implementation here also includes the recommendations of
+ Behrangi et al. [4]_.
Parameters
----------
@@ -226,12 +233,12 @@ Source code for pyjams.sce
``sum(mask)``.
args : tuple, optional
Extra arguments passed to the function *func*. Note that ``args`` must
- be iterable. `args=int`and `args=(int)` are not valid (with int being
- any scalar variable) but should be `args=(int,)`.
+ be iterable. `args=scalar` and `args=(scalar)` are not valid but should
+ be, for example, `args=(scalar,)`.
kwargs : dict, optional
Extra keyword arguments passed to the function `func`.
sampling : string or array_like of strings, optional
- Options for sampling random numbers. Options can be on of:
+ Options for sampling random numbers. Options can be one of:
- 'half-open': same as 'right-half-open' [lb, ub)
- 'left-half-open': sample random floats in half-open
@@ -246,7 +253,7 @@ Source code for pyjams.sce
The default is 'half-open'.
maxn : int, optional
Maximum number of function evaluations allowed during minimization
- (without polishing) (default: 1000).
+ (without polishing) (default: `6400 + 160 * nopt * log10(nopt)`).
kstop : int, optional
Maximum number of evolution loops before convergence (default: 10).
pcento : float, optional
@@ -301,11 +308,12 @@ Source code for pyjams.sce
If True, continue from saved state in `restartfile1` and
`restartfile2` (default: False).
restartfile1 : str, optional
- Filename for saving state of array variables of `SCE` (default: '').
+ Filename for saving state of array variables of optimizer
+ (default: '').
If `restart==True` and `restartfile1==''` then
`restartfile1='sce.restart.npz'` will be taken.
restartfile2 : int, optional
- Filename for saving state of non-array variables of `SCE`
+ Filename for saving state of non-array variables of optimizer
(default: `restartfile1 + '.txt'`).
Returns
@@ -334,11 +342,17 @@ Source code for pyjams.sce
Optimal use of the SCE-UA global optimization method for calibrating
watershed models, Journal of Hydrology 158, 265-284, 1994,
https://doi.org/10.1016/0022-1694(94)90057-4
- .. [4] Behrangi A, Khakbaz B, Vrugt JA, Duan Q, and Sorooshian S
+ .. [4] Behrangi A, Khakbaz B, Vrugt JA, Duan Q, and Sorooshian S,
Comment on "Dynamically dimensioned search algorithm for
computationally efficient watershed model calibration" by
Bryan A. Tolson and Christine A. Shoemaker, Water Resources
Research 44, W12603, 2008, http://doi.org/10.1029/2007WR006429
+ .. [5] Cuntz M, Mai J, Zink M, Thober S, Kumar R, Schäfer D, Schrön M,
+ Craven J, Rakovec O, Spieler D, Prykhodko V, Dalmasso G, Musuuza J,
+ Langenberg B, Attinger S, and Samaniego L,
+ Computationally inexpensive identification of noninformative model
+ parameters by sequential screening. Water Resources Research 51,
+ 6417–6441, 2015, https://doi.org/10.1002/2015WR016907
Examples
--------
@@ -361,8 +375,8 @@ Source code for pyjams.sce
>>> print('{:.3f}'.format(res.fun))
0.001
- A 10-dimensional version using `(min. max)` pars for the bounds and
- setting a number of parameters could be:
+ A 10-dimensional version using `(min, max)` pairs for parameter bounds
+ as well as setting a number of keyword parameters for the SCE algorithm is:
>>> nopt = 10
>>> lb = np.full(10, -5.)
@@ -379,6 +393,7 @@ Source code for pyjams.sce
"""
# using a context manager means that any created Pool objects are
# cleared up.
+ ret = None
with SCESolver(func, x0, lb, ub=ub,
mask=mask, args=args, kwargs=kwargs, sampling=sampling,
maxn=maxn, kstop=kstop, pcento=pcento,
@@ -439,7 +454,7 @@ Source code for pyjams.sce
The default is 'half-open'.
maxn : int, optional
Maximum number of function evaluations allowed during minimization
- (without polishing) (default: 1000).
+ (without polishing) (default: `6400 + 160 * nopt * log10(nopt)`).
kstop : int, optional
Maximum number of evolution loops before convergence (default: 10).
pcento : float, optional
@@ -494,19 +509,21 @@ Source code for pyjams.sce
If True, continue from saved state in `restartfile1` and
`restartfile2` (default: False).
restartfile1 : str, optional
- Filename for saving state of array variables of `SCE` (default: '').
+ Filename for saving state of array variables of optimizer
+ (default: '').
If `restart==True` and `restartfile1==''` then
`restartfile1='sce.restart.npz'` will be taken.
restartfile2 : int, optional
- Filename for saving state of non-array variables of `SCE`
+ Filename for saving state of non-array variables of optimizer
(default: `restartfile1 + '.txt'`).
"""
def __init__(self, func, x0, lb, ub=None,
- mask=None, args=(), kwargs={},
+ mask=None, *,
+ args=(), kwargs={},
sampling='half-open',
- maxn=1000, kstop=10, pcento=0.0001,
+ maxn=0, kstop=10, pcento=0.0001,
ngs=2, npg=0, nps=0, nspl=0, mings=0,
peps=0.001, seed=None, iniflg=True,
alpha=0.8, beta=0.45, maxit=False, printit=2,
@@ -521,7 +538,6 @@ Source code for pyjams.sce
self.rnd = check_random_state(seed)
# parameters for initial run and for restart
self.sampling = sampling
- self.maxn = maxn
self.kstop = kstop
self.pcento = pcento
self.peps = peps
@@ -600,8 +616,7 @@ Source code for pyjams.sce
self.icall = 0
self.xf = np.zeros(self.npt)
for i in range(self.npt):
- fuc = self.func(self.x[i, :])
- self.xf[i] = -fuc if self.maxit else fuc
+ self.xf[i] = self.call_func(self.x[i, :])
self.icall += 1
if self.printit == 1:
print(' i, f, X: ', self.icall, self.xf[i], self.x[i, :])
@@ -614,8 +629,7 @@ Source code for pyjams.sce
for i in range(self.npt):
self.x[i, :] = np.where(self.mask, self.x[i, :], x0)
for i in range(self.npt):
- fuc = self.func(self.x[i, :])
- self.xf[i] = -fuc if self.maxit else fuc
+ self.xf[i] = self.call_func(self.x[i, :])
self.icall += 1
if self.printit == 1:
print(' i, f, X: ', self.icall, self.xf[i],
@@ -655,6 +669,10 @@ Source code for pyjams.sce
self.nn = len(x0)
self.read_restartfiles()
+ self.maxn = (maxn
+ if maxn > 0
+ else int(6400 + 160 * self.nopt * np.log10(self.nopt)))
+
def __enter__(self):
return self
@@ -690,7 +708,7 @@ Source code for pyjams.sce
self.npg + 0.5 -
np.sqrt((self.npg + 0.5)**2 -
self.npg * (self.npg + 1) *
- self.rnd.random_sample(1)) ))
+ self.rnd.random_sample(1)[0]) ))
# check if element was already chosen
idx = (lcs[0:k3] == lpos).nonzero()
if idx[0].size == 0:
@@ -763,6 +781,21 @@ Source code for pyjams.sce
return gnrng
+ def call_func(self, x):
+ """
+ Call function `func` asserting scalar output and maximum or minimum
+
+ """
+ fuc = self.func(x)
+ if isinstance(fuc, np.ndarray):
+ if fuc.size > 1:
+ raise RuntimeError(
+ 'func(x, *args, **kwargs) must return a'
+ ' scalar value.')
+ fuc = fuc[0]
+ fuc = -fuc if self.maxit else fuc
+ return fuc
+
def cce(self, s, sf):
"""
Generate a new point in a simplex
@@ -807,8 +840,7 @@ Source code for pyjams.sce
icall = 0
# calc function for reflection point
- fuc = self.func(snew)
- fnew = -fuc if self.maxit else fuc
+ fnew = self.call_func(snew)
icall += 1
if self.printit == 1:
print(' i, f, X: ', self.icall + icall, fnew, snew)
@@ -817,8 +849,7 @@ Source code for pyjams.sce
if fnew > fw:
snew = sw + self.beta * (ce - sw)
snew = np.where(self.mask, snew, sb)
- fuc = self.func(snew)
- fnew = -fuc if self.maxit else fuc
+ fnew = self.call_func(snew)
icall += 1
if self.printit == 1:
print(' i, f, X: ', self.icall + icall, fnew, snew)
@@ -827,8 +858,7 @@ Source code for pyjams.sce
if fnew > fw:
snew = self.sample_input_matrix(1)[0, :]
snew = np.where(self.mask, snew, sb)
- fuc = self.func(snew)
- fnew = -fuc if self.maxit else fuc
+ fnew = self.call_func(snew)
icall += 1
if self.printit == 1:
print(' i, f, X: ', self.icall + icall, fnew, snew)
@@ -971,7 +1001,7 @@ Source code for pyjams.sce
elif opt == 'open':
iirnd = irnd[j]
while not (iirnd > 0.):
- iirnd = self.rnd.random_sample(1)
+ iirnd = self.rnd.random_sample(1)[0]
x[i, j] = self.lb[j] + iirnd * bound[j]
elif opt == 'log':
# x must be > 0. for ln(x)
@@ -1321,7 +1351,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/screening.html b/docs/html/_modules/pyjams/screening.html
index ab31173..2f7e568 100644
--- a/docs/html/_modules/pyjams/screening.html
+++ b/docs/html/_modules/pyjams/screening.html
@@ -1,10 +1,11 @@
+
- pyjams.screening — pyjams 1.33.dev11 documentation
+ pyjams.screening — pyjams 1.33 documentation
@@ -75,7 +76,7 @@ Source code for pyjams.screening
"""
import numpy as np
-from pyjams import morris_sampling, elementary_effects
+from .morris_method import morris_sampling, elementary_effects
__all__ = ['screening', 'ee']
@@ -768,7 +769,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/str2tex.html b/docs/html/_modules/pyjams/str2tex.html
index 0f7b385..1323452 100644
--- a/docs/html/_modules/pyjams/str2tex.html
+++ b/docs/html/_modules/pyjams/str2tex.html
@@ -1,10 +1,11 @@
+
- pyjams.str2tex — pyjams 1.33.dev11 documentation
+ pyjams.str2tex — pyjams 1.33 documentation
@@ -380,7 +381,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/tee.html b/docs/html/_modules/pyjams/tee.html
index 82c53e0..233dc77 100644
--- a/docs/html/_modules/pyjams/tee.html
+++ b/docs/html/_modules/pyjams/tee.html
@@ -1,10 +1,11 @@
+
- pyjams.tee — pyjams 1.33.dev11 documentation
+ pyjams.tee — pyjams 1.33 documentation
@@ -195,7 +196,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_modules/pyjams/text2plot.html b/docs/html/_modules/pyjams/text2plot.html
index 69ca5e8..9ee2c83 100644
--- a/docs/html/_modules/pyjams/text2plot.html
+++ b/docs/html/_modules/pyjams/text2plot.html
@@ -1,10 +1,11 @@
+
- pyjams.text2plot — pyjams 1.33.dev11 documentation
+ pyjams.text2plot — pyjams 1.33 documentation
@@ -86,10 +87,10 @@ Source code for pyjams.text2plot
"""
import time as ptime
-# from .str2tex import str2tex
-# from .romanliterals import int2roman
-from pyjams.str2tex import str2tex
-from pyjams.romanliterals import int2roman
+from .str2tex import str2tex
+from .romanliterals import int2roman
+# from pyjams.str2tex import str2tex
+# from pyjams.romanliterals import int2roman
__all__ = ['text2plot', 'abc2plot', 'signature2plot']
@@ -656,7 +657,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
diff --git a/docs/html/_sources/index.rst.txt b/docs/html/_sources/index.rst.txt
index 5ef314c..1a79738 100644
--- a/docs/html/_sources/index.rst.txt
+++ b/docs/html/_sources/index.rst.txt
@@ -186,7 +186,7 @@ Functions and modules (alphabetical)
functions to be used with :mod:`scipy.optimize`
* - :func:`~pyjams.gridcellarea`
- Area of grid cells on Earth
- * - :func:`~pyjams.readnetcdf.infonetcdf`
+ * - :func:`~pyjams.ncinfo.infonetcdf`
- Extract information from netCDF file, same as :func:`ncinfo`
* - :func:`~pyjams.romanliterals.int2roman`
- Integer to Roman numeral conversion
@@ -205,12 +205,12 @@ Functions and modules (alphabetical)
Effects
* - :func:`~pyjams.mrair2eair`
- Partial pressure of water vapour from mixing ratio and total pressure
- * - :func:`~pyjams.readnetcdf.ncinfo`
+ * - :func:`~pyjams.ncinfo.ncinfo`
- Extract information from netCDF file
* - :mod:`~pyjams.ncio`
- netCDF4 functions to copy a netcdf file while doing some
transformations on variables and dimensions
- * - :func:`~pyjams.readnetcdf.ncread`
+ * - :func:`~pyjams.ncread.ncread`
- Read variables from netCDF file
* - :func:`~pyjams.class_datetime.num2date`
- Return datetime objects given numeric time values
@@ -218,7 +218,7 @@ Functions and modules (alphabetical)
- Pack array with mask like Fortran intrinsic pack
* - :func:`~pyjams.position`
- Position arrays of subplots to be used with add_axes
- * - :func:`~pyjams.readnetcdf.readnetcdf`
+ * - :func:`~pyjams.ncread.readnetcdf`
- Read variables from netCDF file, same as `ncread`
* - :func:`~pyjams.rhair2eair`
- Partial pressure of water vapour from relative humidity and temperature
@@ -532,16 +532,16 @@ Functions and modules per category
* - Function/module
- Short description
- * - :func:`~pyjams.readnetcdf.infonetcdf`
+ * - :func:`~pyjams.ncinfo.infonetcdf`
- Extract information from netCDF file, same as `ncinfo`
- * - :func:`~pyjams.readnetcdf.ncinfo`
+ * - :func:`~pyjams.ncinfo.ncinfo`
- Extract information from netCDF file
* - :mod:`~pyjams.ncio`
- netCDF4 functions to copy a netcdf file while doing some
transformations on variables and dimensions
- * - :func:`~pyjams.readnetcdf.ncread`
+ * - :func:`~pyjams.ncread.ncread`
- Read variables from netCDF file
- * - :func:`~pyjams.readnetcdf.readnetcdf`
+ * - :func:`~pyjams.ncread.readnetcdf`
- Read variables from netCDF file, same as `ncread`
* - :func:`~pyjams.npyio.updatez`
- Update arrays in uncompressed numpy .npz format
@@ -563,7 +563,7 @@ License
``pyjams`` is distributed under the MIT License. See the LICENSE_ file for
details.
-Copyright (c) 2012-2022 Matthias Cuntz, Juliane Mai, Stephan Thober, and Arndt
+Copyright (c) 2012-2023 Matthias Cuntz, Juliane Mai, Stephan Thober, and Arndt
Piayda
The project structure of ``pyjams`` has borrowed heavily from welltestpy_
diff --git a/docs/html/_sources/readnetcdf.rst.txt b/docs/html/_sources/ncinfo.rst.txt
similarity index 62%
rename from docs/html/_sources/readnetcdf.rst.txt
rename to docs/html/_sources/ncinfo.rst.txt
index 124c4af..7fe5895 100644
--- a/docs/html/_sources/readnetcdf.rst.txt
+++ b/docs/html/_sources/ncinfo.rst.txt
@@ -1,7 +1,7 @@
-info/readnetcdf
----------------
+netcdf info
+-----------
-.. automodule:: pyjams.readnetcdf
+.. automodule:: pyjams.ncinfo
:members:
:undoc-members:
:inherited-members:
diff --git a/docs/html/_sources/ncread.rst.txt b/docs/html/_sources/ncread.rst.txt
new file mode 100644
index 0000000..ab2928b
--- /dev/null
+++ b/docs/html/_sources/ncread.rst.txt
@@ -0,0 +1,12 @@
+read netcdf
+-----------
+
+.. automodule:: pyjams.ncread
+ :members:
+ :undoc-members:
+ :inherited-members:
+ :show-inheritance:
+
+.. raw:: latex
+
+ \clearpage
diff --git a/docs/html/_sources/special_files.rst.txt b/docs/html/_sources/special_files.rst.txt
index 9cc356f..c42f913 100644
--- a/docs/html/_sources/special_files.rst.txt
+++ b/docs/html/_sources/special_files.rst.txt
@@ -4,6 +4,7 @@ Special Files
.. toctree::
fsread.rst
+ ncinfo.rst
ncio.rst
+ ncread.rst
npyio.rst
- readnetcdf.rst
diff --git a/docs/html/_static/documentation_options.js b/docs/html/_static/documentation_options.js
index 5ca6362..4fb66d5 100644
--- a/docs/html/_static/documentation_options.js
+++ b/docs/html/_static/documentation_options.js
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
- VERSION: '1.33.dev11',
+ VERSION: '1.33',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
diff --git a/docs/html/air_humidity.html b/docs/html/air_humidity.html
index 88e321d..54b0a75 100644
--- a/docs/html/air_humidity.html
+++ b/docs/html/air_humidity.html
@@ -1,11 +1,12 @@
+
-
+
- Air humidity — pyjams 1.33.dev11 documentation
+ Air humidity — pyjams 1.33 documentation
@@ -122,17 +123,17 @@
- Parameters:
-ea (float or array_like) – Partial pressure of water vapour [Pa]
-p (float or array_like) – Total air pressure [Pa]
-mol (bool, optional) – It True, return mixing ratio in mol/mol instead of kg/kg
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+ea (float or array_like) – Partial pressure of water vapour [Pa]
+p (float or array_like) – Total air pressure [Pa]
+mol (bool, optional) – It True, return mixing ratio in mol/mol instead of kg/kg
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Mixing ratio [kg/kg] (or in [mol/mol] if mol==True)
- Return type:
-float or array_like
+float or array_like
Examples
@@ -159,16 +160,16 @@
- Parameters:
-ea (float or array_like) – Partial pressure of water vapour [Pa]
-T (float or array_like) – Temperature [K]
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+ea (float or array_like) – Partial pressure of water vapour [Pa]
+T (float or array_like) – Temperature [K]
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Relative humidity [0-1]
- Return type:
-float or array_like
+float or array_like
Examples
@@ -188,16 +189,16 @@
- Parameters:
-ea (float or array_like) – Partial pressure of water vapour [Pa]
-p (float or array_like) – Total air pressure [Pa]
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+ea (float or array_like) – Partial pressure of water vapour [Pa]
+p (float or array_like) – Total air pressure [Pa]
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Specific humidity [kg/kg]
- Return type:
-float or array_like
+float or array_like
Examples
@@ -220,16 +221,16 @@
- Parameters:
-ea (float or array_like) – Partial pressure of water vapour [Pa]
-T (float or array_like) – Temperature [K]
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+ea (float or array_like) – Partial pressure of water vapour [Pa]
+T (float or array_like) – Temperature [K]
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Air vapour pressure deficit [Pa]
- Return type:
-float or array_like
+float or array_like
Examples
@@ -251,8 +252,8 @@
- Parameters:
-T (float or array_like) – Temperature [K]
-formula (str, optional) –
Formula name to use for calculations; case-insensitive.
+
T (float or array_like) – Temperature [K]
+formula (str, optional) –
Formula name to use for calculations; case-insensitive.
Available formulations are:
GoffGratch (default) [1], WMO [2], IAPWS [3], MagnusTeten [4],
MartiMauersberger [5], Buck_original [6], Buck [7], Wexler [8],
@@ -262,15 +263,15 @@
formulation over ice and Marti and Mauersberger do not provide
a formula over liquid: GoffGratch is used in theses cases.
-undef (float, optional) – Exclude T == undef from calculations (default: -9999.)
-liquid (bool, optional) – If True, use liquid formula for all temperatures.
+undef (float, optional) – Exclude T == undef from calculations (default: -9999.)
+liquid (bool, optional) – If True, use liquid formula for all temperatures.
- Returns:
Saturation water pressure at temperature T in Pascal [Pa].
- Return type:
-float or array_like
+float or array_like
@@ -432,17 +433,17 @@
- Parameters:
-mr (float or array_like) – Mixing ratio [kg/kg] (or in [mol/mol] if mol==True)
-p (float or array_like) – Total air pressure [Pa]
-mol (bool, optional) – It True, input mixing ratio is in mol/mol instead of kg/kg
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+mr (float or array_like) – Mixing ratio [kg/kg] (or in [mol/mol] if mol==True)
+p (float or array_like) – Total air pressure [Pa]
+mol (bool, optional) – It True, input mixing ratio is in mol/mol instead of kg/kg
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Partial pressure of water vapour [Pa]
- Return type:
-float or array_like
+float or array_like
Examples
@@ -469,16 +470,16 @@
- Parameters:
-rh (float or array_like) – Relative humidity of air [0-1]
-T (float or array_like) – Temperature [K]
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+rh (float or array_like) – Relative humidity of air [0-1]
+T (float or array_like) – Temperature [K]
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Partial pressure of water vapour [Pa]
- Return type:
-float or array_like
+float or array_like
Examples
@@ -501,16 +502,16 @@
- Parameters:
-rh (float or array_like) – Relative humidity [0-1]
-T (float or array_like) – Temperature [K]
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+rh (float or array_like) – Relative humidity [0-1]
+T (float or array_like) – Temperature [K]
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Air vapour pressure deficit [Pa]
- Return type:
-float or array_like
+float or array_like
Examples
@@ -530,16 +531,16 @@
- Parameters:
-sh (float or array_like) – Specific humidity [kg/kg]
-p (float or array_like) – Total air pressure [Pa]
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+sh (float or array_like) – Specific humidity [kg/kg]
+p (float or array_like) – Total air pressure [Pa]
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Partial pressure of water vapour [Pa]
- Return type:
-float or array_like
+float or array_like
Examples
@@ -562,16 +563,16 @@
- Parameters:
-vpd (float or array_like) – Air vapour pressure deficit [Pa]
-T (float or array_like) – Temperature [K]
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+vpd (float or array_like) – Air vapour pressure deficit [Pa]
+T (float or array_like) – Temperature [K]
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Partial pressure of water vapour [Pa]
- Return type:
-float or array_like
+float or array_like
Examples
@@ -594,16 +595,16 @@
- Parameters:
-vpd (float or array_like) – Air vapour pressure deficit [Pa]
-T (float or array_like) – Temperature [K]
-undef (float, optional) – Exclude undef from calculations (default: -9999.)
+vpd (float or array_like) – Air vapour pressure deficit [Pa]
+T (float or array_like) – Temperature [K]
+undef (float, optional) – Exclude undef from calculations (default: -9999.)
- Returns:
Relative humidity [0-1]
- Return type:
-float or array_like
+float or array_like
Examples
@@ -704,7 +705,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/alpha_equ_h2o.html b/docs/html/alpha_equ_h2o.html
index 601bf7f..bd5d5ac 100644
--- a/docs/html/alpha_equ_h2o.html
+++ b/docs/html/alpha_equ_h2o.html
@@ -1,11 +1,12 @@
+
-
+
- alpha_equ_h2o — pyjams 1.33.dev11 documentation
+ alpha_equ_h2o — pyjams 1.33 documentation
@@ -89,13 +90,13 @@
- Parameters:
-temp (float or array-like) – Temperature [K]
-isotope (int, optional) – Select water isotopologue: 1: HDO; 2: H218O; else: no fractionation,
+
temp (float or array-like) – Temperature [K]
+isotope (int, optional) – Select water isotopologue: 1: HDO; 2: H218O; else: no fractionation,
i.e. return 1 (default)
-undef (float, optional) – Exclude temp == undef from calculations (default: -9999.)
-eps (bool, optional) – Reports fractionation epsilon=alpha-1 instead of fractionation
+
undef (float, optional) – Exclude temp == undef from calculations (default: -9999.)
+eps (bool, optional) – Reports fractionation epsilon=alpha-1 instead of fractionation
factor alpha if True (default: return alpha)
-greater1 (bool, optional) – alpha > 1 if True (default), which is not the atmospheric convention.
+
greater1 (bool, optional) – alpha > 1 if True (default), which is not the atmospheric convention.
alpha < 1 if False, which is the atmospheric convention.
@@ -103,7 +104,7 @@
alpha / epsilon – Equilibrium fractionation factor (alpha) or fractionation (epsilon)
- Return type:
-float or array-like
+float or array-like
@@ -227,7 +228,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/alpha_kin_h2o.html b/docs/html/alpha_kin_h2o.html
index 09ffa03..814f122 100644
--- a/docs/html/alpha_kin_h2o.html
+++ b/docs/html/alpha_kin_h2o.html
@@ -1,11 +1,12 @@
+
-
+
- alpha_kin_h2o — pyjams 1.33.dev11 documentation
+ alpha_kin_h2o — pyjams 1.33 documentation
@@ -73,15 +74,15 @@
- Parameters:
-isotope (int, optional) – Select water isotopologue: 1: HDO; 2: H218O; else: no fractionation,
+
isotope (int, optional) – Select water isotopologue: 1: HDO; 2: H218O; else: no fractionation,
i.e. return 1 (default)
-eps (bool, optional) – Returns fractionation epsilon=alpha-1 instead of fractionation factor
+
eps (bool, optional) – Returns fractionation epsilon=alpha-1 instead of fractionation factor
alpha if True (default: return alpha)
-greater1 (bool, optional) – alpha > 1 if True, which is not the atmospheric convention.
+
greater1 (bool, optional) – alpha > 1 if True, which is not the atmospheric convention.
alpha < 1 if False, which is the atmospheric convention.
-boundary (bool, optional) – Returns alpha**2/3 for diffusion through boundary layer instead of
+
boundary (bool, optional) – Returns alpha**2/3 for diffusion through boundary layer instead of
molecular diffusion if True (default: False).
-cappa (bool, optional) – Uses factors of Cappa et al. (2003) instead of Merlivat (1978) if True
+
cappa (bool, optional) – Uses factors of Cappa et al. (2003) instead of Merlivat (1978) if True
(default: False).
@@ -89,7 +90,7 @@
alpha / epsilon – Kinetic fractionation factor (alpha) or fractionation (epsilon)
- Return type:
-float or array-like
+float or array-like
@@ -221,7 +222,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/api.html b/docs/html/api.html
index f006b2f..72a85b6 100644
--- a/docs/html/api.html
+++ b/docs/html/api.html
@@ -1,11 +1,12 @@
+
-
+
- API Reference — pyjams 1.33.dev11 documentation
+ API Reference — pyjams 1.33 documentation
@@ -114,9 +115,15 @@ Subpackages
Morris' Method of Elementary Effects.
-
+ncinfo
(ncfile[, var, code, variables, ...])
+Get information on variables in a netcdf file
+
+
netCDF4 functions to copy a netcdf file while doing some transformations on variables and dimensions.
+ncread
(ncfile[, var, code, squeeze, ...])
+Gets variables of a netcdf file
+
Update arrays in a single file in numpy's npz format
@@ -126,25 +133,22 @@ Subpackagesposition
([row, col, num, left, right, ...])
Gives positions of subplots, to be used with add_axes instead of subplot
-readnetcdf
(*args, **kwargs)
-Wrapper for ncread()
-
-
+
Convert integer to and from Roman numerals
-sce
(func, x0, lb[, ub, mask, args, kwargs, ...])
-Shuffled-Complex-Evolution algorithm for function minimization
+sce
(func, x0, lb[, ub, mask, args, kwargs, ...])
+Shuffled Complex Evolution algorithm for finding the minimum of a multivariate function
-screening
(func, lb, ub, nt[, x0, mask, ...])
+screening
(func, lb, ub, nt[, x0, mask, ...])
Parameter screening using Morris' method of Elementary Effects.
-str2tex
(strin[, space2linebreak, bold, ...])
+str2tex
(strin[, space2linebreak, bold, ...])
Convert strings to LaTeX strings in math environment used by matplotlib's usetex
-tee
(*args, **kwargs)
+tee
(*args, **kwargs)
Prints arguments on screen and in file, like Unix/Linux tee utility.
-text2plot
(handle, dx, dy, itext[, small, ...])
+text2plot
(handle, dx, dy, itext[, small, ...])
Write text on plot
@@ -190,6 +194,10 @@ SubpackagesSpecial Files
@@ -347,7 +356,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/argsort.html b/docs/html/argsort.html
index 1688495..1a35107 100644
--- a/docs/html/argsort.html
+++ b/docs/html/argsort.html
@@ -1,11 +1,12 @@
+
-
+
- argmax/argmin/argsort — pyjams 1.33.dev11 documentation
+ argmax/argmin/argsort — pyjams 1.33 documentation
@@ -97,7 +98,7 @@
a[np.unravel_index(argmax(a), a.shape)] is the maximum value of a.
Return type:
-ndarray, int
+ndarray, int
@@ -192,7 +193,7 @@
a[np.unravel_index(argmin(a), a.shape)] is the minimum value of a.
Return type:
-ndarray, int
+ndarray, int
@@ -292,7 +293,7 @@
If a is one-dimensional, a[index_array] yields a sorted a.
Return type:
-ndarray, int
+ndarray, int
@@ -483,7 +484,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/array_manipulation.html b/docs/html/array_manipulation.html
index 09e5eb6..87ea6d3 100644
--- a/docs/html/array_manipulation.html
+++ b/docs/html/array_manipulation.html
@@ -1,11 +1,12 @@
+
-
+
- Array Manipulation — pyjams 1.33.dev11 documentation
+ Array Manipulation — pyjams 1.33 documentation
@@ -143,7 +144,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/ascii_files.html b/docs/html/ascii_files.html
index 89fc0e3..c5da0ec 100644
--- a/docs/html/ascii_files.html
+++ b/docs/html/ascii_files.html
@@ -1,11 +1,12 @@
+
-
+
- ASCII Files — pyjams 1.33.dev11 documentation
+ ASCII Files — pyjams 1.33 documentation
@@ -135,7 +136,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/authors.html b/docs/html/authors.html
index 3414151..c837eeb 100644
--- a/docs/html/authors.html
+++ b/docs/html/authors.html
@@ -1,11 +1,12 @@
+
-
+
- Authors — pyjams 1.33.dev11 documentation
+ Authors — pyjams 1.33 documentation
@@ -35,7 +36,7 @@
Authors¶
Created Oct 2021 by Matthias Cuntz from the JAMS Python library.
It is distributed under the MIT License, see LICENSE file.
-Copyright (c) 2012-2022 Matthias Cuntz, Juliane Mai, Stephan Thober, and Arndt
+
Copyright (c) 2012-2023 Matthias Cuntz, Juliane Mai, Stephan Thober, and Arndt
Piayda
- Contributors
@@ -114,7 +115,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/changelog.html b/docs/html/changelog.html
index 4ffb719..b17436d 100644
--- a/docs/html/changelog.html
+++ b/docs/html/changelog.html
@@ -1,11 +1,12 @@
+
-
+
- Changelog — pyjams 1.33.dev11 documentation
+ Changelog — pyjams 1.33 documentation
@@ -15,7 +16,7 @@
-
+
@@ -35,7 +36,33 @@
Changelog¶
-- v2.0 (??? 2023)
+- v2.1 (??? 2023)
+Split ncread and ncinfo in individual files.
+Rename readnetcdf file to ncread.
+Check if scalar is number in array2input.
+license_file deprecated in setuptools, use license_files.
+
+
+- v2.0 (Sep 2023)
+Set maximum number of function evaluations to N*log(N) formula in sce.
+Require keyword names after mask in sce.
+New call_func method in sce to catch new numpy behaviour that
+single-valued array does not compare to scalar anymore. Same for sampling
+a single random number.
+Change from np.ones*fill_value to np.full in pack.
+Add tests with pandas.Series and pandas.DataFrame to remaining functions.
+Changed from around to round in tests of the air_humidity module.
+Added _FillValue and missing_value to netcdf test files for ncread and
+ncio.
+Cleaned tests for ncread and ncinfo.
+Raise error in Morris sampling if more than one component changed at once.
+
+
+- v1.33 (Jul 2023)
+ncio.create_variables sets missing_value attribute if present even if
+used for _FillValue.
+ncio.get_variable_definition returns _FillValue if present and only
+missing_value if _FillValue is not present.
Add tests with pandas.Series and pandas.DataFrame to (almost) all
existing functions.
Remove from future imports from all pyjams
main modules (not jams)
@@ -111,7 +138,6 @@
Skip test for float128 on Windows in ncio.
Python 3.6 might not be fully supported anymore.
Remove dependency to partialwrap
for tests.
-Remove dependency to partialwrap
for tests.
Adding sce the Shuffled-Complex-Evolution algorithm for function
minimization.
Adding ‘a wide variety of’ to pyjams
key phrase.
@@ -429,7 +455,7 @@ Navigation
Related Topics
- Documentation overview
- - Previous: info/readnetcdf
+ - Previous: updatez
- Next: Contributing
@@ -452,7 +478,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/class_datetime.html b/docs/html/class_datetime.html
index 0cf0852..f3261d4 100644
--- a/docs/html/class_datetime.html
+++ b/docs/html/class_datetime.html
@@ -1,11 +1,12 @@
+
-
+
- datetime module — pyjams 1.33.dev11 documentation
+ datetime module — pyjams 1.33 documentation
@@ -137,7 +138,7 @@
-
class datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, dayofwk=-1, dayofyr=-1, calendar='decimal', has_year_zero=None)[source]¶
-Bases: object
+Bases: object
This class mimics cftime.datetime but for non-CF-conform calendars
The cftime.datetime class mimics itself datetime.datetime but
supports calendars other than the proleptic Gregorian calendar.
@@ -342,11 +343,11 @@
- Parameters:
-dates (datetime instance or str, or array_like of datetime or str) – datetime objects or strings with string representations.
+
dates (datetime instance or str, or array_like of datetime or str) – datetime objects or strings with string representations.
datetime objects can either be Python datetime.datetime,
cf.datetime, or pyjams.datetime objects. If dates are strings,
then format keyword is relevant.
-units (str, optional) –
Units string such as ‘seconds since 1900-01-01 00:00:00’ or
+
units (str, optional) –
Units string such as ‘seconds since 1900-01-01 00:00:00’ or
‘day as %Y%m%d.%f’. Standard units corresponding to days after
day 0 of a given calendar will be used if omitted, i.e. assuming
Julian day ordinals.
@@ -360,7 +361,7 @@
the same as ‘calendar=decimal’. calendar=’decimal’ will be set in
case units *time_units as format.
-calendar (str, optional) – One of the supported calendars, i.e. the CF-conform calendars
+
calendar (str, optional) – One of the supported calendars, i.e. the CF-conform calendars
standard, gregorian, julian, proleptic_gregorian,
360_day, 365_day, 366_day, noleap, all_leap,
as well as the non-CF-conform calendars
@@ -369,7 +370,7 @@
standard will be taken by default, which is a mixed
Julian/Gregorian calendar.
The keyword takes precedence on calendar in datetime objects.
-has_year_zero (bool, optional) – Astronomical year numbering is used and the year zero exists, if set to
+
has_year_zero (bool, optional) – Astronomical year numbering is used and the year zero exists, if set to
True. If set to False for real-world calendars, then historical year
numbering is used and the year 1 is preceded by year -1 and no year
zero exists.
@@ -381,20 +382,20 @@
or above so has_year_zero is always False.
Decimal calendars decimal, decimal360, decimal365, decimal366
have always year 0, i.e. has_year_zero is True.
-format (str, optional) – If dates are strings, then format is the Python
+
format (str, optional) – If dates are strings, then format is the Python
datetime.strftime/strptime format string if given. If empty (default),
then the routine pyjams.date2date will be used, which converts between
formats ‘%Y-%m-%d %H:%M:%S’, ‘%d.%m.%Y %H:%M:%S’, and ‘%m/%d/%Y
%H:%M:%S’ (called English YYYY-MM-DD hh:mm:ss, standard
DD.MM.YYYY hh:mm:ss, and American MM/DD/YYYY hh:mm:ss in
pyjams.date2date), where times can be partial or missing.
-timesep (str, optional) – Separator string between date and time used by pyjams.date2date if
+
timesep (str, optional) – Separator string between date and time used by pyjams.date2date if
if dates are strings and format is empty (default: ‘ ‘)
-fr (bool, optional) – If True, pyjams.date2date will interpret input dates with ‘/’
+
fr (bool, optional) – If True, pyjams.date2date will interpret input dates with ‘/’
separators not as the American format ‘%m/%d/%Y %H:%M:%S’ but the
French way as ‘%d/%m/%Y %H:%M:%S’, if dates are strings and
format is empty
-return_arrays (bool, optional) – If True, then return a tuple with individual arrays for
+
return_arrays (bool, optional) – If True, then return a tuple with individual arrays for
year, month, day, hour, minute, second, microsecond
@@ -440,8 +441,8 @@
- Parameters:
-times (float or array_like) – Numeric time values
-units (str, optional) –
Units string such as ‘seconds since 1900-01-01 00:00:00’ or
+
times (float or array_like) – Numeric time values
+units (str, optional) –
Units string such as ‘seconds since 1900-01-01 00:00:00’ or
‘day as %Y%m%d.%f’. Standard units corresponding to days after
day 0 of a given calendar will be used if omitted, i.e. assuming
Julian day ordinals.
@@ -455,7 +456,7 @@
the same as ‘calendar=decimal’. calendar=’decimal’ will be set in
case units *time_units as format.
-calendar (str, optional) – One of the support calendars, i.e. the CF-conform calendars
+
calendar (str, optional) – One of the support calendars, i.e. the CF-conform calendars
standard, gregorian, julian, proleptic_gregorian,
360_day, 365_day, 366_day, noleap, all_leap,
as well as the non-CF-conform calendars
@@ -463,28 +464,28 @@
decimal, decimal360, decimal365, decimal366.
standard will be taken by default, which is a mixed
Julian/Gregorian calendar.
-only_use_pyjams_datetimes (bool, optional) – pyjams.datetime objects are returned by default.
+
only_use_pyjams_datetimes (bool, optional) – pyjams.datetime objects are returned by default.
Only if only_use_pyjams_datetimes is set to False (default: True) and
only_use_cftime_datetimes is set to True then cftime.datetime objects
will be returned where possible.
Only if only_use_pyjams_datetimes and only_use_cftime_datetimes are set
to False and only_use_python_datetimes is set to True then Python
datetime.datetime objects will be returned where possible.
-only_use_cftime_datetimes (bool, optional) – pyjams.datetime objects are returned by default.
+
only_use_cftime_datetimes (bool, optional) – pyjams.datetime objects are returned by default.
Only if only_use_pyjams_datetimes is set to False and
only_use_cftime_datetimes is set to True (default: False) then
cftime.datetime objects will be returned where possible.
Only if only_use_pyjams_datetimes and only_use_cftime_datetimes are set
to False and only_use_python_datetimes is set to True then Python
datetime.datetime objects will be returned where possible.
-only_use_python_datetimes (bool, optional) – pyjams.datetime objects are returned by default.
+
only_use_python_datetimes (bool, optional) – pyjams.datetime objects are returned by default.
Only if only_use_pyjams_datetimes is set to False and
only_use_cftime_datetimes is set to True then cftime.datetime objects
will be returned where possible.
Only if only_use_pyjams_datetimes and only_use_cftime_datetimes are set
to False and only_use_python_datetimes is set to True (default: False)
then Python datetime.datetime objects will be returned where possible.
-has_year_zero (bool, optional) – Astronomical year numbering is used and the year zero exists, if set to
+
has_year_zero (bool, optional) – Astronomical year numbering is used and the year zero exists, if set to
True. If set to False for real-world calendars, then historical year
numbering is used and the year 1 is preceded by year -1 and no year
zero exists.
@@ -496,9 +497,9 @@
or above so has_year_zero is always False.
Decimal calendars decimal, decimal360, decimal365, decimal366
have always year 0, i.e. has_year_zero is True.
-format (str, optional) – If format string is given than a string representation of the
+
format (str, optional) – If format string is given than a string representation of the
datetime objects will be returned.
-return_arrays (bool, optional) – If True, then return a tuple with individual arrays for
+
return_arrays (bool, optional) – If True, then return a tuple with individual arrays for
year, month, day, hour, minute, second, microsecond
@@ -620,7 +621,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/closest.html b/docs/html/closest.html
index c7da1ff..c9640c0 100644
--- a/docs/html/closest.html
+++ b/docs/html/closest.html
@@ -1,11 +1,12 @@
+
-
+
- closest — pyjams 1.33.dev11 documentation
+ closest — pyjams 1.33 documentation
@@ -77,7 +78,7 @@
arr (array_like) – Array to search closest entry
num (number) – Number to which the closest entry is searched for in arr
-value (bool, optional) – Returns closest array element instead of index if True (default: False)
+value (bool, optional) – Returns closest array element instead of index if True (default: False)
- Returns:
@@ -85,7 +86,7 @@
Use np.unravel_index to get index tuple.
- Return type:
--
+
-
Examples
@@ -205,7 +206,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/color.brewer_palettes.html b/docs/html/color.brewer_palettes.html
index 217bc10..d8f5e13 100644
--- a/docs/html/color.brewer_palettes.html
+++ b/docs/html/color.brewer_palettes.html
@@ -1,11 +1,12 @@
+
-
+
- Brewer palettes — pyjams 1.33.dev11 documentation
+ Brewer palettes — pyjams 1.33 documentation
@@ -158,7 +159,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/color.color.html b/docs/html/color.color.html
index 8ff1900..928eb2e 100644
--- a/docs/html/color.color.html
+++ b/docs/html/color.color.html
@@ -1,11 +1,12 @@
+
-
+
- Color functions — pyjams 1.33.dev11 documentation
+ Color functions — pyjams 1.33 documentation
@@ -93,30 +94,30 @@
- Parameters:
-palette (str) – Name of color palette or continuous colormap
-ncol (int, optional) – Number of desired colors.
+
palette (str) – Name of color palette or continuous colormap
+ncol (int, optional) – Number of desired colors.
If 0, all colors defined by the specific palette will be returned.
256 colors will be chosen for continuous colormaps.
If > 0, existing color palettes will be subsampled to ncol colors.
ncol colors will be produced from continuous colormaps.
-offset (float (0-1), optional) – Bottom fraction to exclude for subsample or continuous colormaps
-upper (float (0-1), optional) – Upper most fraction to include for subsample or continuous colormaps
-reverse (bool, optional) – Reverse colormap if True (default: False). This can also be achieved by
+
offset (float (0-1), optional) – Bottom fraction to exclude for subsample or continuous colormaps
+upper (float (0-1), optional) – Upper most fraction to include for subsample or continuous colormaps
+reverse (bool, optional) – Reverse colormap if True (default: False). This can also be achieved by
adding ‘_r’ to the palette name. Palettes that end with ‘_r’ will not
be reversed.
-grey (bool, optional) – Return grey equivalent colors if True (default: False).
-order (str, optional) – Order colors by ‘hue’, ‘saturation’, or ‘value’.
+
grey (bool, optional) – Return grey equivalent colors if True (default: False).
+order (str, optional) – Order colors by ‘hue’, ‘saturation’, or ‘value’.
This is done before reverse and grey
(default: order from color sources).
-as_cmap (bool, optional) – If True, returns matplotlib.colors.Colormap
+
as_cmap (bool, optional) – If True, returns matplotlib.colors.Colormap
instead of list of RGB tuples
- Returns:
-List of RGB tuples or matplotlib.colors.Colormap
+List of RGB tuples or matplotlib.colors.Colormap
- Return type:
-list or matplotlib.colors.Colormap
+-
@@ -124,7 +125,7 @@
get_cmap always returns a list of RGB tuples or a Matplotlib
ListedColormap. You can use the ncol, offset, and upper keywords to
subsample colormaps. To get smoothly-varying colormaps, you can use the
-method matplotlib.colors.LinearSegmentedColormap.from_list()
+method matplotlib.colors.LinearSegmentedColormap.from_list()
cols = get_cmap(‘sron_ylorbr’)
cmap = matplotlib.colors.LinearSegmentedColormap.from_list(cols)
@@ -149,7 +150,7 @@
which can be any color name known to Matplotlib.
Examples
@@ -166,7 +167,7 @@
Print the known named colors
- Parameters:
-collection (str or list of strings, optional) – Name(s) of color collection(s).
+
collection (str or list of strings, optional) – Name(s) of color collection(s).
Known collections are ‘base’, ‘tableau’, ‘ufz’, ‘css’,
and ‘xkcd’.
@@ -189,7 +190,7 @@
Print the known color palettes and continuous colormaps
- Parameters:
-collection (str or list of strings, optional) – Name(s) of color palette collection(s).
+
collection (str or list of strings, optional) – Name(s) of color palette collection(s).
Known collections are ‘pyjams’, ‘sron’, ‘sron2012’, ‘mathematica’,
‘oregon’, ‘ncl’, ‘matplotlib’, and ‘brewer’.
@@ -214,8 +215,8 @@
- Parameters:
-outfile (str, optional) – Output file name. Output type will be determined from file suffix.
-collection (str or list of strings, optional) – Name(s) of color palette collection(s).
+
outfile (str, optional) – Output file name. Output type will be determined from file suffix.
+collection (str or list of strings, optional) – Name(s) of color palette collection(s).
All palettes will be shown if collection is empty or ‘all’.
Known collections are: ‘pyjams’, ‘sron’, ‘sron2012’, ‘mathematica’,
‘oregon’, ‘ncl’, ‘matplotlib’, and ‘brewer’.
@@ -333,7 +334,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/color.html b/docs/html/color.html
index c27b986..8c414e4 100644
--- a/docs/html/color.html
+++ b/docs/html/color.html
@@ -1,11 +1,12 @@
+
-
+
- Color module — pyjams 1.33.dev11 documentation
+ Color module — pyjams 1.33 documentation
@@ -84,30 +85,30 @@ Subpackages
- Parameters:
-palette (str) – Name of color palette or continuous colormap
-ncol (int, optional) – Number of desired colors.
+
palette (str) – Name of color palette or continuous colormap
+ncol (int, optional) – Number of desired colors.
If 0, all colors defined by the specific palette will be returned.
256 colors will be chosen for continuous colormaps.
If > 0, existing color palettes will be subsampled to ncol colors.
ncol colors will be produced from continuous colormaps.
-offset (float (0-1), optional) – Bottom fraction to exclude for subsample or continuous colormaps
-upper (float (0-1), optional) – Upper most fraction to include for subsample or continuous colormaps
-reverse (bool, optional) – Reverse colormap if True (default: False). This can also be achieved by
+
offset (float (0-1), optional) – Bottom fraction to exclude for subsample or continuous colormaps
+upper (float (0-1), optional) – Upper most fraction to include for subsample or continuous colormaps
+reverse (bool, optional) – Reverse colormap if True (default: False). This can also be achieved by
adding ‘_r’ to the palette name. Palettes that end with ‘_r’ will not
be reversed.
-grey (bool, optional) – Return grey equivalent colors if True (default: False).
-order (str, optional) – Order colors by ‘hue’, ‘saturation’, or ‘value’.
+
grey (bool, optional) – Return grey equivalent colors if True (default: False).
+order (str, optional) – Order colors by ‘hue’, ‘saturation’, or ‘value’.
This is done before reverse and grey
(default: order from color sources).
-as_cmap (bool, optional) – If True, returns matplotlib.colors.Colormap
+
as_cmap (bool, optional) – If True, returns matplotlib.colors.Colormap
instead of list of RGB tuples
- Returns:
-List of RGB tuples or matplotlib.colors.Colormap
+List of RGB tuples or matplotlib.colors.Colormap
- Return type:
-list or matplotlib.colors.Colormap
+-
@@ -115,7 +116,7 @@ Subpackagesmatplotlib.colors.LinearSegmentedColormap.from_list()
+method matplotlib.colors.LinearSegmentedColormap.from_list()
cols = get_cmap(‘sron_ylorbr’)
cmap = matplotlib.colors.LinearSegmentedColormap.from_list(cols)
@@ -140,7 +141,7 @@ Subpackages
- Parameters:
-cname (str or iterable of str, optional) – Colour name(s)
+-
Examples
@@ -157,7 +158,7 @@ Subpackages
- Parameters:
-collection (str or list of strings, optional) – Name(s) of color collection(s).
+
collection (str or list of strings, optional) – Name(s) of color collection(s).
Known collections are ‘base’, ‘tableau’, ‘ufz’, ‘css’,
and ‘xkcd’.
@@ -180,7 +181,7 @@ Subpackages
- Parameters:
-collection (str or list of strings, optional) – Name(s) of color palette collection(s).
+
collection (str or list of strings, optional) – Name(s) of color palette collection(s).
Known collections are ‘pyjams’, ‘sron’, ‘sron2012’, ‘mathematica’,
‘oregon’, ‘ncl’, ‘matplotlib’, and ‘brewer’.
@@ -205,8 +206,8 @@ Subpackages
- Parameters:
-outfile (str, optional) – Output file name. Output type will be determined from file suffix.
-collection (str or list of strings, optional) – Name(s) of color palette collection(s).
+
outfile (str, optional) – Output file name. Output type will be determined from file suffix.
+collection (str or list of strings, optional) – Name(s) of color palette collection(s).
All palettes will be shown if collection is empty or ‘all’.
Known collections are: ‘pyjams’, ‘sron’, ‘sron2012’, ‘mathematica’,
‘oregon’, ‘ncl’, ‘matplotlib’, and ‘brewer’.
@@ -334,7 +335,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/color.mathematica_palettes.html b/docs/html/color.mathematica_palettes.html
index 1f1c6eb..bcbc660 100644
--- a/docs/html/color.mathematica_palettes.html
+++ b/docs/html/color.mathematica_palettes.html
@@ -1,11 +1,12 @@
+
-
+
- Mathematica palettes — pyjams 1.33.dev11 documentation
+ Mathematica palettes — pyjams 1.33 documentation
@@ -143,7 +144,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/color.ncl_palettes.html b/docs/html/color.ncl_palettes.html
index 0f43ef1..45db93c 100644
--- a/docs/html/color.ncl_palettes.html
+++ b/docs/html/color.ncl_palettes.html
@@ -1,11 +1,12 @@
+
-
+
- NCL palettes — pyjams 1.33.dev11 documentation
+ NCL palettes — pyjams 1.33 documentation
@@ -150,7 +151,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/color.oregon_palettes.html b/docs/html/color.oregon_palettes.html
index 0e07044..8c425c7 100644
--- a/docs/html/color.oregon_palettes.html
+++ b/docs/html/color.oregon_palettes.html
@@ -1,11 +1,12 @@
+
-
+
- Oregon palettes — pyjams 1.33.dev11 documentation
+ Oregon palettes — pyjams 1.33 documentation
@@ -150,7 +151,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/color.sron2012_palettes.html b/docs/html/color.sron2012_palettes.html
index 000e4b8..b9be0e6 100644
--- a/docs/html/color.sron2012_palettes.html
+++ b/docs/html/color.sron2012_palettes.html
@@ -1,11 +1,12 @@
+
-
+
- SRON2012 palettes — pyjams 1.33.dev11 documentation
+ SRON2012 palettes — pyjams 1.33 documentation
@@ -145,7 +146,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/color.sron_palettes.html b/docs/html/color.sron_palettes.html
index de44488..0247cb3 100644
--- a/docs/html/color.sron_palettes.html
+++ b/docs/html/color.sron_palettes.html
@@ -1,11 +1,12 @@
+
-
+
- SRON palettes — pyjams 1.33.dev11 documentation
+ SRON palettes — pyjams 1.33 documentation
@@ -147,7 +148,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/color.ufz_palettes.html b/docs/html/color.ufz_palettes.html
index 7189427..259c4dd 100644
--- a/docs/html/color.ufz_palettes.html
+++ b/docs/html/color.ufz_palettes.html
@@ -1,11 +1,12 @@
+
-
+
- UFZ colors — pyjams 1.33.dev11 documentation
+ UFZ colors — pyjams 1.33 documentation
@@ -139,7 +140,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/const.const.html b/docs/html/const.const.html
index fdeb2fd..e8a4ddd 100644
--- a/docs/html/const.const.html
+++ b/docs/html/const.const.html
@@ -1,11 +1,12 @@
+
-
+
- Constants — pyjams 1.33.dev11 documentation
+ Constants — pyjams 1.33 documentation
@@ -530,7 +531,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/const.html b/docs/html/const.html
index 77d2393..5f18fb0 100644
--- a/docs/html/const.html
+++ b/docs/html/const.html
@@ -1,11 +1,12 @@
+
-
+
- Constant module — pyjams 1.33.dev11 documentation
+ Constant module — pyjams 1.33 documentation
@@ -153,7 +154,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/contents.html b/docs/html/contents.html
index 35c6b29..849e4c3 100644
--- a/docs/html/contents.html
+++ b/docs/html/contents.html
@@ -1,11 +1,12 @@
+
-
+
- Contents — pyjams 1.33.dev11 documentation
+ Contents — pyjams 1.33 documentation
@@ -109,9 +110,10 @@ ContentsSpecial Files
@@ -189,7 +191,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/contributing.html b/docs/html/contributing.html
index 82528e9..a0dd62b 100644
--- a/docs/html/contributing.html
+++ b/docs/html/contributing.html
@@ -1,11 +1,12 @@
+
-
+
- Contributing — pyjams 1.33.dev11 documentation
+ Contributing — pyjams 1.33 documentation
@@ -146,7 +147,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/data_processing.html b/docs/html/data_processing.html
index 79ec99c..4914883 100644
--- a/docs/html/data_processing.html
+++ b/docs/html/data_processing.html
@@ -1,11 +1,12 @@
+
-
+
- Data Processing — pyjams 1.33.dev11 documentation
+ Data Processing — pyjams 1.33 documentation
@@ -141,7 +142,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/date2date.html b/docs/html/date2date.html
index fbcbbd4..3dba87e 100644
--- a/docs/html/date2date.html
+++ b/docs/html/date2date.html
@@ -1,11 +1,12 @@
+
-
+
- date2date module — pyjams 1.33.dev11 documentation
+ date2date module — pyjams 1.33 documentation
@@ -143,18 +144,18 @@
edate (array_like) – Date strings in any of three formats standard, English, or
American/French.
-fr (bool, optional) – Input dates with ‘/’ separators are interpreted as American format
+
fr (bool, optional) – Input dates with ‘/’ separators are interpreted as American format
MM/DD/YYYY hh:mm:ss if False (default). Input dates with ‘/’
separators are interpreted as French format DD/MM/YYYY hh:mm:ss if
True.
-format (str, optional) – Output format. Can be any of ‘’ (default), ‘en’, ‘us’, and ‘fr’ for
+
format (str, optional) – Output format. Can be any of ‘’ (default), ‘en’, ‘us’, and ‘fr’ for
standard DD.MM.YYYY hh:mm:ss, English YYYY-MM-DD hh:mm:ss, American
MM/DD/YYYY hh:mm:ss, and French DD/MM/YYYY hh:mm:ss format.
format can also be any format string understood by
datetime.strftime()
.
-timesep (str, optional) – Separator string between date and time if format is ‘’, ‘en’, ‘us’,
+
timesep (str, optional) – Separator string between date and time if format is ‘’, ‘en’, ‘us’,
or ‘fr’. Default is space ‘ ‘, but ISO 8601 uses ‘T’, for example.
-full (bool, optional) – Output dates are as long as input dates if False (default), e.g.
+
full (bool, optional) – Output dates are as long as input dates if False (default), e.g.
[YYYY-MM-DD, YYYY-MM-DD hh:mm]. Output dates are all in full format
DD.MM.YYYY hh:mm:ss if True; missing time info on input is 00 on
output.
@@ -177,9 +178,9 @@
as being in 1900, i.e. 90 will be taken as 1990, while all other years are
taken in the 21st century, i.e. 20 will be 2020. 3-digit years will throw
a ValueError.
-Negative years are not supported. The function uses datetime
if a
+
Negative years are not supported. The function uses datetime
if a
format string for datetime.strftime()
is given. This limits the
-minimum year to the limit of datetime
in this case, which is year
+minimum year to the limit of datetime
in this case, which is year
‘0001’.
Examples
@@ -624,7 +625,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/date_time.html b/docs/html/date_time.html
index cf26d1c..529ae0d 100644
--- a/docs/html/date_time.html
+++ b/docs/html/date_time.html
@@ -1,11 +1,12 @@
+
-
+
- Date and Time — pyjams 1.33.dev11 documentation
+ Date and Time — pyjams 1.33 documentation
@@ -166,7 +167,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/division.html b/docs/html/division.html
index 4a0199b..e06c416 100644
--- a/docs/html/division.html
+++ b/docs/html/division.html
@@ -1,11 +1,12 @@
+
-
+
- division — pyjams 1.33.dev11 documentation
+ division — pyjams 1.33 documentation
@@ -112,8 +113,8 @@
-
- Returns:
@@ -259,7 +260,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/fgui.html b/docs/html/fgui.html
index ca4bd91..3d4e522 100644
--- a/docs/html/fgui.html
+++ b/docs/html/fgui.html
@@ -1,11 +1,12 @@
+
-
+
- directory/file dialog — pyjams 1.33.dev11 documentation
+ directory/file dialog — pyjams 1.33 documentation
@@ -81,15 +82,15 @@
- Parameters:
-initialdir (str, optional) – Initial directory, in which opens GUI (default: ‘.’)
-title (str, optional) – Title of GUI (default: ‘Choose one or several directories’)
+initialdir (str, optional) – Initial directory, in which opens GUI (default: ‘.’)
+title (str, optional) – Title of GUI (default: ‘Choose one or several directories’)
- Returns:
Selected directories
- Return type:
--
+
-
Examples
@@ -108,15 +109,15 @@
- Parameters:
-initialdir (str, optional) – Initial directory, in which opens GUI (default: ‘.’)
-title (str, optional) – Title of GUI (default: ‘Choose directory’)
+initialdir (str, optional) – Initial directory, in which opens GUI (default: ‘.’)
+title (str, optional) – Title of GUI (default: ‘Choose directory’)
- Returns:
Selected directory
- Return type:
--
+
-
Examples
@@ -149,9 +150,9 @@
- Parameters:
-initialdir (str, optional) – Initial directory, in which opens GUI (default: ‘.’)
-title (str, optional) – Title of GUI (default: ‘Choose file(s)’)
-multiple (bool, optional) – Allow selection of multiple files if True (default),
+
initialdir (str, optional) – Initial directory, in which opens GUI (default: ‘.’)
+title (str, optional) – Title of GUI (default: ‘Choose file(s)’)
+multiple (bool, optional) – Allow selection of multiple files if True (default),
else it is only possible to select one single file.
@@ -159,7 +160,7 @@
Selected file(s)
- Return type:
--
+
-
@@ -269,7 +270,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/fsread.html b/docs/html/fsread.html
index 510e9ac..7527bc7 100644
--- a/docs/html/fsread.html
+++ b/docs/html/fsread.html
@@ -1,11 +1,12 @@
+
-
+
- fsread / xread — pyjams 1.33.dev11 documentation
+ fsread / xread — pyjams 1.33 documentation
@@ -136,15 +137,15 @@
- Parameters:
-infile (str) – Source file name
-nc (int or iterable, optional) – Number of columns to be read as floats [default: all (nc=0)]. nc
+
infile (str) – Source file name
+nc (int or iterable, optional) – Number of columns to be read as floats [default: all (nc=0)]. nc
can be an int or a vector of column indexes, starting with 0.
nc<=0 reads all columns.
-cname (iterable of str, optional) – Columns for floats can be chosen by the values in the first header
+
cname (iterable of str, optional) – Columns for floats can be chosen by the values in the first header
line; must be an iterable with strings.
-snc (int or iterable, optional) – Not used in fread; will be silently ignored.
-sname (iterable of str, optional) – Not used in fread; will be silently ignored.
-**kwargs (dict, optional) – All other keywords will be passed to fsread.
+snc (int or iterable, optional) – Not used in fread; will be silently ignored.
+sname (iterable of str, optional) – Not used in fread; will be silently ignored.
+**kwargs (dict, optional) – All other keywords will be passed to fsread.
- Returns:
@@ -292,7 +293,7 @@
... print('2.1 nan Inf "NaN"', file=ff)
-Treat Nan and Inf with automatic strip of “ and ‘
+Treat Nan and Inf with automatic strip of ” and ‘
>>> print(fread(filename1, skip=1, transpose=True))
[[1.1 2.1]
[1.2 nan]
@@ -377,55 +378,55 @@
- Parameters:
-infile (str) – Source file name
-nc (int or iterable, optional) – Number of columns to be read as floats [default: none (nc=0)]. nc
+
infile (str) – Source file name
+nc (int or iterable, optional) – Number of columns to be read as floats [default: none (nc=0)]. nc
can be an int or a vector of column indexes, starting with 0. If
snc!=0, then nc must be iterable, or -1 to read all other columns
as floats. If both nc and snc are int, then first snc string
columns will be read and then nc float columns will be read.
-cname (iterable of str, optional) – Columns for floats can be chosen by the values in the first header
+
cname (iterable of str, optional) – Columns for floats can be chosen by the values in the first header
line; must be an iterable with strings.
-snc (int or iterable, optional) – Number of columns to be read as strings [default: none (snc=0)].
+
snc (int or iterable, optional) – Number of columns to be read as strings [default: none (snc=0)].
snc can be an int or a vector of column indexes, starting with 0. If
nc!=0, then snc must be iterable, or -1 to read all other columns
as strings. If both nc and snc are int, then first snc string
columns will be read and then nc float columns will be read.
-sname (iterable of str, optional) – Columns for strings can be chosen by the values in the first header
+
sname (iterable of str, optional) – Columns for strings can be chosen by the values in the first header
line; must be an iterable with strings.
-skip (int, optional) – Number of lines to skip at the beginning of file (default: 0)
-cskip (int, optional) – Number of columns to skip at the beginning of each line (default: 0)
-hskip (int, optional) – Number of lines in skip that do not belong to header (default: 0)
-separator (str, optional) – Column separator. If not given, columns separators are (in order):
+
skip (int, optional) – Number of lines to skip at the beginning of file (default: 0)
+cskip (int, optional) – Number of columns to skip at the beginning of each line (default: 0)
+hskip (int, optional) – Number of lines in skip that do not belong to header (default: 0)
+separator (str, optional) – Column separator. If not given, columns separators are (in order):
comma (‘,’), semicolon (‘;’), whitespace.
-squeeze (bool, optional) – If set to True, the 2-dim array will be cleaned of degenerated
+
squeeze (bool, optional) – If set to True, the 2-dim array will be cleaned of degenerated
dimension, possibly resulting in a vector, otherwise output is always
2-dimensional.
-skip_blank (bool, optional) – Continues reading after a blank line if True, else stops reading
+
skip_blank (bool, optional) – Continues reading after a blank line if True, else stops reading
at the first blank line (default).
comment (iterable, optional) – Line gets excluded if the first character is in comment sequence.
Sequence must be iterable such as string, list and tuple, .e.g ‘#’ or
[‘#’, ‘!’].
-fill (bool, optional) – Fills in fill_value if True and not enough columns in input line,
+
fill (bool, optional) – Fills in fill_value if True and not enough columns in input line,
else raises ValueError (default).
-fill_value (float, optional) – Value to fill in float array in empty cells or if not enough columns
+
fill_value (float, optional) – Value to fill in float array in empty cells or if not enough columns
in line and fill==True (default: numpy.nan).
-sfill_value (str, optional) – Value to fill in string array in empty cells or if not enough columns
+
sfill_value (str, optional) – Value to fill in string array in empty cells or if not enough columns
in line and fill==True (default: ‘’).
-strip (str, optional) – Strip float columns with str.strip(strip). If strip is None,
-quotes “ and ‘ are stripped from input fields (default), otherwise the
+
strip (str, optional) – Strip float columns with str.strip(strip). If strip is None,
+quotes ” and ‘ are stripped from input fields (default), otherwise the
character in strip is stripped from the input fields.
strip has to be set explicitly to also strip string columns.
If strip is set to False then nothing is stripped and reading is
about 30% faster.
-hstrip (bool, optional) – Strip header cells to match cname if True (default), else take header
+
hstrip (bool, optional) – Strip header cells to match cname if True (default), else take header
cells literally.
-encoding (str, optional) – Specifies the encoding which is to be used for the file
+
encoding (str, optional) – Specifies the encoding which is to be used for the file
(default: ‘ascii’).
Any encoding that encodes to and decodes from bytes is allowed.
-errors (str, optional) – Errors may be given to define the error handling during encoding
+
errors (str, optional) – Errors may be given to define the error handling during encoding
of the file.
Possible values are ‘strict’, ‘replace’, and ‘ignore’ (default).
-header (bool, optional) –
Return header strings instead of numbers/strings in rest of file. This
+
header (bool, optional) –
Return header strings instead of numbers/strings in rest of file. This
allows to use (almost) the same call to get values and header:
head, shead = fsread(ifile, nc=1, snc=1, header=True)
data, sdata = fsread(ifile, nc=1, snc=1)
@@ -433,13 +434,13 @@
-full_header (bool, optional) – Header will be a list of the header lines if set.
-transpose (bool, optional) – fsread reads in row-major format, i.e. the first dimension are the
+
full_header (bool, optional) – Header will be a list of the header lines if set.
+transpose (bool, optional) – fsread reads in row-major format, i.e. the first dimension are the
rows and second dimension are the columns out(:nrow, :ncol). This
will be transposed to column-major format out(:ncol, :nrow) if
transpose is set.
-strarr (bool, optional) – Return header as numpy array rather than list.
-return_list (bool, optional) – Return lists rather than arrays.
+strarr (bool, optional) – Return header as numpy array rather than list.
+return_list (bool, optional) – Return lists rather than arrays.
- Returns:
@@ -624,32 +625,32 @@
- Parameters:
-infile (str) – Source file name
-nc (int or iterable, optional) – Number of columns to be read as strings [default: all (nc=0)]. nc
+
infile (str) – Source file name
+nc (int or iterable, optional) – Number of columns to be read as strings [default: all (nc=0)]. nc
can be an int or a vector of column indexes, starting with 0.
nc<=0 reads all columns.
snc takes precedence if nc and snc are set.
-cname (iterable of str, optional) – Columns for floats can be chosen by the values in the first header
+
cname (iterable of str, optional) – Columns for floats can be chosen by the values in the first header
line; must be an iterable with strings.
sname takes precedence if cname and sname are set.
-snc (int or iterable, optional) – Number of columns to be read as strings [default: all (snc=0)].
+
snc (int or iterable, optional) – Number of columns to be read as strings [default: all (snc=0)].
snc can be an int or a vector of column indexes, starting with 0.
snc<=0 reads all columns.
snc takes precedence if nc and snc are set.
-sname (iterable of str, optional) – Columns for strings can be chosen by the values in the first header
+
sname (iterable of str, optional) – Columns for strings can be chosen by the values in the first header
line; must be an iterable with strings.
sname takes precedence if cname and sname are set.
-fill_value (float, optional) – Value to fill in string array in empty cells or if not enough columns
+
fill_value (float, optional) – Value to fill in string array in empty cells or if not enough columns
in line and fill==True (default: ‘’).
sfill_value takes precedence if fill_value and sfill_value are
set.
-sfill_value (str, optional) – Value to fill in string array in empty cells or if not enough columns
+
sfill_value (str, optional) – Value to fill in string array in empty cells or if not enough columns
in line and fill==True (default: ‘’).
sfill_value takes precedence if fill_value and sfill_value are
set.
fill_value – value to fill in array in empty cells or if not enough columns in line
and fill==True (default: ‘’).
-header (bool, optional) –
Return header strings instead of strings in rest of file. This
+
header (bool, optional) –
Return header strings instead of strings in rest of file. This
allows to use (almost) the same call to get values and header:
shead = sread(ifile, nc=2, header=True)
sdata = sread(ifile, nc=2)
@@ -657,8 +658,8 @@
-full_header (bool, optional) – Header will be a list of the header lines if set.
-**kwargs (dict, optional) – All other keywords will be passed to fsread.
+full_header (bool, optional) – Header will be a list of the header lines if set.
+**kwargs (dict, optional) – All other keywords will be passed to fsread.
- Returns:
@@ -867,43 +868,43 @@
- Parameters:
-infile (str) – Excel source file name
-sheet (str or int, optional) – Name or number of Excel sheet (default: first sheet)
-nc (int or iterable, optional) – Number of columns to be read as floats [default: none (nc=0)]. nc
+
infile (str) – Excel source file name
+sheet (str or int, optional) – Name or number of Excel sheet (default: first sheet)
+nc (int or iterable, optional) – Number of columns to be read as floats [default: none (nc=0)]. nc
can be an int or a vector of column indexes, starting with 0. If
snc!=0, then nc must be iterable, or -1 to read all other columns
as floats. If both nc and snc are int, then first snc string
columns will be read and then nc float columns will be read.
-cname (iterable of str, optional) – Columns for floats can be chosen by the values in the first header
+
cname (iterable of str, optional) – Columns for floats can be chosen by the values in the first header
line; must be an iterable with strings.
-snc (int or iterable, optional) – Number of columns to be read as strings [default: none (snc=0)].
+
snc (int or iterable, optional) – Number of columns to be read as strings [default: none (snc=0)].
snc can be an int or a vector of column indexes, starting with 0. If
nc!=0, then snc must be iterable, or -1 to read all other columns
as strings. If both nc and snc are int, then first snc string
columns will be read and then nc float columns will be read.
-sname (iterable of str, optional) – Columns for strings can be chosen by the values in the first header
+
sname (iterable of str, optional) – Columns for strings can be chosen by the values in the first header
line; must be an iterable with strings.
-skip (int, optional) – Number of lines to skip at the beginning of file (default: 0)
-cskip (int, optional) – Number of columns to skip at the beginning of each line (default: 0)
-hskip (int, optional) – Number of lines in skip that do not belong to header (default: 0)
-squeeze (bool, optional) – If set to True, the 2-dim array will be cleaned of degenerated
+
skip (int, optional) – Number of lines to skip at the beginning of file (default: 0)
+cskip (int, optional) – Number of columns to skip at the beginning of each line (default: 0)
+hskip (int, optional) – Number of lines in skip that do not belong to header (default: 0)
+squeeze (bool, optional) – If set to True, the 2-dim array will be cleaned of degenerated
dimension, possibly resulting in a vector, otherwise output is always
2-dimensional.
-fill (bool, optional) – Fills in fill_value if True and not enough columns in input line,
+
fill (bool, optional) – Fills in fill_value if True and not enough columns in input line,
else raises ValueError (default).
-fill_value (float, optional) – Value to fill in float array in empty cells or if not enough columns
+
fill_value (float, optional) – Value to fill in float array in empty cells or if not enough columns
in line and fill==True (default: numpy.nan).
-sfill_value (str, optional) – Value to fill in string array in empty cells or if not enough columns
+
sfill_value (str, optional) – Value to fill in string array in empty cells or if not enough columns
in line and fill==True (default: ‘’).
-strip (str, optional) – Strip float columns with str.strip(strip). If strip is None,
-quotes “ and ‘ are stripped from input fields (default), otherwise the
+
strip (str, optional) – Strip float columns with str.strip(strip). If strip is None,
+quotes ” and ‘ are stripped from input fields (default), otherwise the
character in strip is stripped from the input fields.
strip has to be set explicitly to also strip string columns.
If strip is set to False then nothing is stripped and reading is
about 30% faster for text files.
-hstrip (bool, optional) – Strip header cells to match cname if True (default), else take header
+
hstrip (bool, optional) – Strip header cells to match cname if True (default), else take header
cells literally.
-header (bool, optional) –
Return header strings instead of numbers/strings in rest of file. This
+
header (bool, optional) –
Return header strings instead of numbers/strings in rest of file. This
allows to use (almost) the same call to get values and header:
head, shead = xread(ifile, nc=1, snc=1, header=True)
data, sdata = xread(ifile, nc=1, snc=1)
@@ -911,13 +912,13 @@
-full_header (bool, optional) – Header will be a list of the header lines if set.
-transpose (bool, optional) – fsread reads in row-major format, i.e. the first dimension are the
+
full_header (bool, optional) – Header will be a list of the header lines if set.
+transpose (bool, optional) – fsread reads in row-major format, i.e. the first dimension are the
rows and second dimension are the columns out(:nrow, :ncol). This
will be transposed to column-major format out(:ncol, :nrow) if
transpose is set.
-strarr (bool, optional) – Return header as numpy array rather than list.
-return_list (bool, optional) – Return lists rather than arrays.
+strarr (bool, optional) – Return header as numpy array rather than list.
+return_list (bool, optional) – Return lists rather than arrays.
- Returns:
@@ -1132,9 +1133,10 @@ Navigation
- Plotting
- Special Files
@@ -1188,7 +1190,7 @@ Quick search
©2012-2023, Matthias Cuntz, Juliane Mai, Stephan Thober, Arndt Piayda.
|
- Powered by Sphinx 7.0.1
+ Powered by Sphinx 6.2.1
& Alabaster 0.7.13
|
diff --git a/docs/html/functions.fit_functions.html b/docs/html/functions.fit_functions.html
index a231401..a4da3a5 100644
--- a/docs/html/functions.fit_functions.html
+++ b/docs/html/functions.fit_functions.html
@@ -1,11 +1,12 @@
+
-
+
- Fit functions — pyjams 1.33.dev11 documentation
+ Fit functions — pyjams 1.33 documentation
@@ -90,8 +91,8 @@
gauss()
, gauss_p()
, cost_gauss()
, cost2_gauss()
: