This release is a pre-release and may not be stable for production use.
das3py
Das servers typically provide data relevant to space plasma and magnetospheric physics research. To retrieve data, an HTTP GET request is posted to a das server by a client program and a self-describing stream of data values covering the requested time range, at the requested time resolution, is provided in the response body. This package, das3py provides an efficient space physics data client for python. Streams are parsed and stored as NumPy arrays using a C extension, avoiding data copies and conversions.
das3py was published as das2py through version 3.0.4. See Upgrading from das2py below.
Installing from PyPI
python -m pip install das3py
Anaconda Package
What changed in 3.0
The short version, for people upgrading from 2.3:
- The package is
das3now. It reads das3 streams, so it's named for them.import das2keeps working as an alias, installed by the das2py transitional package, and points at the very same modules, so old and new code mix without a fuss. The pip name is nowdas3py. Python 2.7 and 3.x are both fine;das3says nothing about the interpreter. - Composite values. Vectors, rotation matrices, quaternions and complex
pairs come through as one variable with a trailing internal shape, so a
vector over N records is an (N, 3) array in a shape (N,) dataset. Each
variable carries its
<ops>formalism as a dict (var.ops), one label per component (var.labels), andvar.extShape()/var.intrShape()for the two halves of the shape, withvar.extRank/var.intrRankcounting them.var.storage()gives the values without the dataset's broadcast. - Sequences are materialized. A coordinate defined by a
<sequence>in the stream header arrives as a real array now instead of going missing. - Dimensions know what they are.
dim.kindis'coord'or'data', andds.coordKeys()/ds.dataKeys()list one kind at a time. - Tidier names.
dir(das3)shows the public API and nothing else. A few methods were renamed to match the rest:DasTime.fromString,DasTime.roundDoy,Dimension.hasPropandhasPropVal(replacingpropEq) andSource.infoProto. The 2.3 names still work and warn, so old scripts keep running.Quantity.to_valuekeeps its snake_case on purpose, since that's AstroPy's name for the same thing. - das_verify checks more. Index counts against the dataset rank, one
units=per composite, and<sequence>counts against the internal shape, none of which an XML schema can express. - Not yet: ragged arrays (variable length records) still don't convert to ndarrays. das2C reads them; das3py stops at the conversion.
Upgrading from das2py
As of version 3.0 the package is das3, named for the das3 stream format,
and as of 3.0.6 it is distributed as das3py. It runs on Python 2.7 and
3.x alike.
The das2py name on PyPI is now a small transitional package. Upgrading
it installs das3py and adds a das2 alias, so import das2 keeps working
and returns the very same modules as import das3. das3py on its own does
not provide import das2.
python -m pip install -U das2py # existing installs: das3py plus the alias
python -m pip install das3py # new code: das3 only
If you install das3py next to an old das2py 2.x instead of upgrading it,
remove the old one first (pip uninstall das2py), as both provide a
das_verify command.
The alias raises a PendingDeprecationWarning, which Python hides by
default. To find the places in a project that still use the old name, run
it with that warning promoted to an error:
python -W error::PendingDeprecationWarning your_script.py
Pre-build versions of das3py are available from Anaconda. If you're working in an Anoconda or Miniconda python 3 environment these are easier to install as no C compiler is required. To install the conda package run the command:
(base) $ conda install -c dasdevelopers das3py
The anaconda package automatically pulls in das2C, pycdf, and pthreads4w as needed.
If this works then test using:
(base) $ wget https://raw.githubusercontent.com/das-developers/das3py/main/examples/ex02_galileo_pws_spectra.py
(base) $ python ex02_galileo_pws_spectra.py
If this command produces a plot similar to the following...
...then das3py is installed, and you can skip building the software and head straight the example program below.
Building and Installing from Source on Linux
Compilation and installation of das3py is regularly tested on Linux under both Python 2 (still) and Python 3. Testing on Windows and MacOS is less frequent, and then only under Python 3. The following packages are required to build das3py and all dependencies:
-
Get system software packages.
Rocky Linux or Compatable
dnf install git gcc make curl expat-devel fftw-devel openssl-devel python3-devel
Debian Linux or Compatable
apt install gcc git make curl libexpat-dev libfftw3-dev libssl-dev python3-dev
-
Get the source, along with the das2C it goes with.
git clone --recursive https://github.com/das-developers/das3py.git
das2C is a git submodule in
deps/das2C, pegged to the das2C release this das3py was written and tested against. If you cloned without--recursivethat directory is empty; fill it withgit submodule update --init. -
Build and test sources against a specific version of python. The makefile will automatically find python if
PY_BINis not defined, but providing an explicit path avoids confusion down the road. For old Python2 builds, PY_BIN is required, as Python3 will be built by default.cd das3py make PY_BIN=/path/to/python # See PY_BIN note above make PY_BIN=/path/to/python test # optional, but recommended make PY_BIN=/path/to/python examples # optional, needs network access
The first
makealso builds the bundled das2C, which downloads the sources of NASA's CDF library. To use a CDF you already have, setCDF_INCandCDF_LIBas das2C's own build notes describe.To build against some other das2C, a development checkout for example, build that one yourself and name it. das3py then leaves it alone:
make DAS2C=/path/to/das2C PY_BIN=/path/to/python
-
Install into your desired python environment.
/path/to/python -m pip install ./dist/das3py-*.whl # or make PY_BIN=/path/to/python install
Alternate builds
To build from source under anaconda, or for Windows or MacOS hosts and to interact with PyPI see the alternate instructions in buildfiles/ReadMe.md
First program
The following small program demonstrates how to query for data and generate a plot using das3py.
Query a URI for reduced resolution data
import das3
src = das3.get_source( 'tag:das2.org,2012:site:/uiowa/galileo/pws/survey_electric/das2' )
header, datasets = src.get( {'time' : ('1997-05-07T15:00', '1997-05-07T17:00', 4.0)} )
get()returns the stream header and a list of datasets. This instrument sends three, one for each of its frequency bands.- Servers come and go. The federated catalog provides stability for application code by maping URIs to data sources.
- Browse for URIs using a das2 catalog browser, or using das3py to get the root node (see example 11).
Access quantities by physical dimensions
dataset = datasets[0]
print(dataset)
vX = dataset['time']['center']
vY = dataset['frequency']['center']
vZ = dataset['electric']['center']
- Datasets contain dimensions. Dimensions contain variables. Each variable in a dimension serves a purpose, the most common is to define the center point of a coordinate or measurement.
- Array dimensions are not confused with physical dimensions. Dataset meaning is not tied to any particular array morphology.
Use Matplotlib to generate an image.
import matplotlib.pyplot as pyplot
import matplotlib.colors as colors
fig, ax = pyplot.subplots()
scaleZ = colors.LogNorm(vmin=1e-17, vmax=1e-4) # One color scale for all bands
for dataset in datasets:
vX = dataset['time']['center']
vY = dataset['frequency']['center']
vZ = dataset['electric']['center']
ax.pcolormesh(vX.array, vY.array, vZ.array, norm=scaleZ, cmap='jet')
ax.set_yscale('log')
pyplot.show()
Reporting bugs
Please use the github.com issue tracker report any problems with the library. If you've fixed a bug, 1) thanks!, 2) please send a pull request so that your updates can be merged into the main project.
Metadata
Release files for das3py 3.0.6rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 37.6 MB
Release files / das3py-3.0.6rc1-cp315-cp315-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | das3py-3.0.6rc1-cp315-cp315-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.15 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
8914fb9c9d8f510d0f9e275fdb79514ff1f2846e5baf0bc5fa2978ab40d9885b
|
|
BLAKE2b-256 checksum How to use checksums |
1d9ac5853591f620d8c0fcee186d15af559e993eeb6759e72ade6356f266705c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / das3py-3.0.6rc1-cp314-cp314-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | das3py-3.0.6rc1-cp314-cp314-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.14 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f003131c0cef842c1c277e59514242c31cf61757feab79c870283f903298d895
|
|
BLAKE2b-256 checksum How to use checksums |
175820bc267e6ccd543c269d0a415795c16fd20403fbdbfdadd6bb4d6b6fd93b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / das3py-3.0.6rc1-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | das3py-3.0.6rc1-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.13 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e0ee0a00bd04a8c34b9ca3db4e3ffc4395fd2388acf5dab26d6d1893c2f8877c
|
|
BLAKE2b-256 checksum How to use checksums |
d9775847b90cc5ad78e6d401490e693f297b2f3c3034c65efde607bb908c45cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / das3py-3.0.6rc1-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | das3py-3.0.6rc1-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.12 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
55a2529f538e40d62cf90d8ecbf4c94a195c739d7c08dbc97474d9eebbbee320
|
|
BLAKE2b-256 checksum How to use checksums |
bf2035487713fb1ab43e27856d226adf9903d8ed35280b1d67e36630645e5220
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / das3py-3.0.6rc1-cp311-cp311-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | das3py-3.0.6rc1-cp311-cp311-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.11 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
ff726a748698a6d8350a88f62ba15648dcad75673e643653c52a7681ece750ae
|
|
BLAKE2b-256 checksum How to use checksums |
eacd5940bb09d69d4b6b85f2f05756eb362bb41c6a947b3c8cba33f92f45fced
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / das3py-3.0.6rc1-cp310-cp310-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | das3py-3.0.6rc1-cp310-cp310-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.10 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9c8a307980a63430a86cef8ebf2afa287757f7ab609d07426de99f6f9dd573ea
|
|
BLAKE2b-256 checksum How to use checksums |
e9432c954074be4fc8ccb9e1b3f11e35bf99abf09cc8c2537f15f2da1622c47e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / das3py-3.0.6rc1-cp39-cp39-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | das3py-3.0.6rc1-cp39-cp39-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.9 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
403c74d14d5295bdc14c78a63cac9ff7a710499721c291e3b685c21a4699cfe2
|
|
BLAKE2b-256 checksum How to use checksums |
b27f9cb913a33eeff2e996c390e0a299de5370ee4faecb7df063fd8b66b44ab0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / das3py-3.0.6rc1-cp27-cp27mu-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | das3py-3.0.6rc1-cp27-cp27mu-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
feeefdc07bef0799e158b93142c22b9b64dccd41a5fa905552452b254288b92f
|
|
BLAKE2b-256 checksum How to use checksums |
22451dd709a2d68e6e9c41f6e18a2b20b8d933bf4d57af7f032e25f813579ad9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for das3py 3.0.6rc1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.