!pip install aiohttp matplotlib pandas pyarrow requests "xarray[io]"
import pandas as pd
URL = 'https://mastapp.site'
Quickstart#
This notebook shows some very simple example of getting started.
List All Shots#
shots_df = pd.read_parquet(f'{URL}/parquet/level2/shots')
shots_df
| shot_id | campaign | ohmnic_energy_total | radii_s_area_max_current | equi_max_li3_time | generic_dt_energy_max_current | generic_s_area_max | divertor_config | generic_dt_total_energy | generic_plasma_elongation_max_current | ... | nbi_energy_ss_max_current | nbi_total_injected_energy_ss | nbi_injected_energy_ss_ruby_time | nbi_power_ss_max_current | nbi_power_truby_ss | shot_scenario | scenario | rad_o2ratio | radii_c2ratio | shot_flat_top_duration | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 11766 | M5 | 0.114530 | 22.644779 | 0.270 | -192676.851518 | 23.362010 | Conventional | 430281.62 | 1.601573 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| 1 | 11767 | M5 | 0.134566 | 22.002382 | 0.150 | -82970.042801 | 23.469263 | Conventional | 254662.14 | 1.594044 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| 2 | 11768 | M5 | 0.129432 | 23.027416 | 0.270 | -113603.034418 | 23.507900 | Conventional | 401462.44 | 1.612653 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| 3 | 11769 | M5 | 0.156508 | 22.759919 | 0.290 | -127591.593586 | 23.938997 | Conventional | 283884.00 | 1.673236 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| 4 | 11771 | M5 | 0.131940 | 22.525058 | 0.290 | -164363.251971 | 23.959898 | Conventional | 309404.78 | 1.655904 | ... | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN | NaN | NaN |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 11568 | 30467 | M9 | 0.094553 | 25.402852 | 0.030 | 31972.688440 | 25.416924 | Conventional | 2307703.20 | 1.930563 | ... | 0.137379 | 0.340425 | 0.000195 | 2.180491 | NaN | S6 | 3.0 | NaN | NaN | NaN |
| 11569 | 30468 | M9 | 0.095056 | 25.509430 | 0.030 | -146041.829662 | 25.541964 | Conventional | 2943505.20 | 1.938207 | ... | 0.155259 | 0.288250 | 0.000208 | 1.985447 | NaN | S8 | 2.0 | NaN | NaN | NaN |
| 11570 | 30469 | M9 | 0.074943 | 25.318623 | 0.035 | 133309.409983 | 25.418210 | Conventional | 840205.30 | 1.933172 | ... | 0.293718 | 0.328446 | 0.000189 | 2.288206 | NaN | S6 | 3.0 | NaN | NaN | NaN |
| 11571 | 30470 | M9 | 0.236737 | 27.009387 | 0.035 | -501857.330985 | 28.405008 | Conventional | 4641571.50 | 1.924374 | ... | 0.274879 | 0.294526 | 0.000207 | 2.107413 | NaN | S8 | 2.0 | NaN | NaN | NaN |
| 11572 | 30471 | M9 | 0.372848 | 24.728233 | 0.035 | -506018.886237 | 25.858627 | Conventional | 25309066.00 | 1.882437 | ... | 0.136419 | 0.171676 | 0.000202 | NaN | NaN | S8 | 2.0 | NaN | NaN | NaN |
11573 rows × 189 columns
List All Sources#
sources_df = pd.read_parquet(f"{URL}/parquet/level2/sources")
sources_df
| shot_id | context_ | quality | title | name | endpoint_url | type_ | description | uuid | url | imas | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 11766 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | equilibrium | https://s3.echo.stfc.ac.uk | dcat:Dataset | 0f3fbb3a-8915-593b-8a5e-bb2801bd5b6d | s3://mast/level2/shots/11766.zarr | equilibrium | |
| 1 | 11766 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | gas_injection | https://s3.echo.stfc.ac.uk | dcat:Dataset | 21df071f-d08f-540c-8f39-a799dc34535c | s3://mast/level2/shots/11766.zarr | gas_injection | |
| 2 | 11766 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | magnetics | https://s3.echo.stfc.ac.uk | dcat:Dataset | c97c0e5c-c26c-52af-9b37-f6660d08726d | s3://mast/level2/shots/11766.zarr | magnetics | |
| 3 | 11766 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | pf_active | https://s3.echo.stfc.ac.uk | dcat:Dataset | ba47b2a2-a6da-5d8e-b6c2-e093fbfc3553 | s3://mast/level2/shots/11766.zarr | pf_active | |
| 4 | 11766 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | pulse_schedule | https://s3.echo.stfc.ac.uk | dcat:Dataset | 46662499-0e12-5e7a-a8b8-ec44cdfca24d | s3://mast/level2/shots/11766.zarr | pulse_schedule | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 105993 | 30471 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | gas_injection | https://s3.echo.stfc.ac.uk | dcat:Dataset | 9d2c7bbd-8592-5e3b-a358-921879f34bd4 | s3://mast/level2/shots/30471.zarr | gas_injection | |
| 105994 | 30471 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | magnetics | https://s3.echo.stfc.ac.uk | dcat:Dataset | 7118a52b-91bc-5575-ae9d-388552642b72 | s3://mast/level2/shots/30471.zarr | magnetics | |
| 105995 | 30471 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | pf_active | https://s3.echo.stfc.ac.uk | dcat:Dataset | 8a94267d-3c38-516b-83ee-27ba71348716 | s3://mast/level2/shots/30471.zarr | pf_active | |
| 105996 | 30471 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | spectrometer_visible | https://s3.echo.stfc.ac.uk | dcat:Dataset | 7d455235-58fb-5918-9d04-0653d4972b89 | s3://mast/level2/shots/30471.zarr | None | |
| 105997 | 30471 | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | Not Checked | Source Dataset | summary | https://s3.echo.stfc.ac.uk | dcat:Dataset | 5da1f1a6-c70f-5ad6-97c4-8e3b1f91da04 | s3://mast/level2/shots/30471.zarr | summary |
105998 rows × 11 columns
List all signals Given a Shot Number#
signals_df = pd.read_parquet(f"{URL}/parquet/level2/signals?shot_id=30421")
signals_df
| shot_id | title | units | shape | uuid | imas | context_ | name | version | description | rank | dimensions | url | quality | endpoint_url | type_ | source | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 30421 | Signal Dataset | A | [18, 3633] | 8bc9806b-7a97-53fd-b0ff-45e141eb7fdc | magnetics | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | b_field_pol_probe_obr_field | 0 | 2 | [b_field_pol_probe_obr_channel, time] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | magnetics | |
| 1 | 30421 | Signal Dataset | eV | [73, 160] | 75756c34-c5b1-5e75-a53e-82bd90635d75 | charge_exchange | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | t_i | 0 | 2 | [time, major_radius] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | charge_exchange | |
| 2 | 30421 | Signal Dataset | eV | [73, 160] | dcb14130-bf6a-5cc3-90ff-3985dad388a7 | charge_exchange | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | v_i | 0 | 2 | [time, major_radius] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | charge_exchange | |
| 3 | 30421 | Signal Dataset | [146] | eb848f08-2f4e-54a6-8bd5-98a98823aa2e | equilibrium | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | beta_normal | 0 | 1 | [time] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | equilibrium | ||
| 4 | 30421 | Signal Dataset | [146] | cb95202b-279e-524a-b6af-899729ca9298 | equilibrium | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | beta_pol | 0 | 1 | [time] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | equilibrium | ||
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 68 | 30421 | Signal Dataset | eV | [146, 120] | f0b586cd-11ea-5208-927b-4e4f057a6c44 | thomson_scattering | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | n_e | 0 | 2 | [time, major_radius] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | thomson_scattering | |
| 69 | 30421 | Signal Dataset | eV | [146] | 097cfe72-4d53-5a04-a7dc-97b1898e6e98 | thomson_scattering | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | n_e_core | 0 | 1 | [time] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | thomson_scattering | |
| 70 | 30421 | Signal Dataset | eV | [146, 120] | 23c0ad57-6ff8-5222-9a7a-c897b661b9ad | thomson_scattering | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | p_e | 0 | 2 | [time, major_radius] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | thomson_scattering | |
| 71 | 30421 | Signal Dataset | eV | [146, 120] | 6e2f4faf-7eb6-5f9e-a8a3-f0869af4abbf | thomson_scattering | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | t_e | 0 | 2 | [time, major_radius] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | thomson_scattering | |
| 72 | 30421 | Signal Dataset | eV | [146] | c83667d9-fd83-5808-90b9-bb6750e98b77 | thomson_scattering | {'dcat': 'http://www.w3.org/ns/dcat#', 'dct': ... | t_e_core | 0 | 1 | [time] | s3://mast/level2/shots/30421.zarr | Not Checked | https://s3.echo.stfc.ac.uk | dcat:Dataset | thomson_scattering |
73 rows × 17 columns
Open and plot shot data.#
Here we are visualising some plasma current data.
import xarray as xr
import matplotlib.pyplot as plt
dataset = xr.open_zarr(
"https://s3.echo.stfc.ac.uk/mast/level2/shots/30421.zarr",
group='summary'
)
dataset['ip'].plot()
plt.show()