dgahle / mast-upgrade-baysar-analysis

Scripts to analyse the atomic line spectrum measured from the MAST-Upgrade tokamak.
MIT License
0 stars 1 forks source link

Open-ADAS (API): ADF11 - get, load, and read functionality #12

Closed dgahle closed 1 year ago

dgahle commented 1 year ago

adf11 is the most common derived ADAS data type used after adf15. Hence the functionality to get, load, and read adf11 data as has already been created for adf15.

Example url: https://open.adas.ac.uk/detail/adf11/scd96r/scd96r_n.dat

adf11name: str = f"{adf11type}{year}{resolution}_{element}.dat" resolution is "r" or "" Download url: f"https://open.adas.ac.uk/download/adf11/{adf11type}{year}{resolution}/{adf11name}"

Types: ACD, SCD, PLT, PRB

Tests for each H-12-u, C-96-u, N-89-r, Ne-96-r

dgahle commented 1 year ago

This should be done when Open-ADAS is made into it's own repo in preparation for PyPI deployment.

dgahle commented 1 year ago

Functionality added and all tests passed. Need to assess warnings in pytests (from xarray interpolation), and write doc strings and.

=========================== test session starts ============================ platform darwin -- Python 3.8.16, pytest-7.1.2, pluggy-1.0.0 rootdir: /Users/daljeet-singh-gahle/github/mast-upgrade-baysar-analysis collected 43 items

tests/test_main.py .. [ 4%] tests/OpenADAS/test_get_adf11.py ......... [ 25%] tests/OpenADAS/test_get_adf15.py ...... [ 39%] tests/OpenADAS/test_read_adf11.py .................. [ 81%] tests/OpenADAS/test_read_adf15.py ........ [100%]

============================= warnings summary ============================= tests/OpenADAS/test_read_adf11.py::TestReadAdf11::test_H_ACD_yr12 tests/OpenADAS/test_read_adf11.py::TestReadAdf11Power::test_H_PLT_yr12 tests/OpenADAS/test_read_adf11.py::TestReadAdf11Power::test_H_PRB_yr12 /Users/daljeet-singh-gahle/opt/anaconda3/envs/mast-upgrade-analysis/lib/python3.8/site-packages/scipy/interpolate/_interpolate.py:698: RuntimeWarning: invalid value encountered in divide slope = (y_hi - y_lo) / (x_hi - x_lo)[:, None]

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ===================== 43 passed, 3 warnings in 13.90s ======================

dgahle commented 1 year ago

Interpolation issue is due to the block axis only having a single dimension and thus cannot calculate (y_hi - y_lo) / (x_hi - x_lo) (0 / 0)