pytolnet package
Subpackages
Module contents
TOLNet API
Utilities for retrieving and plotting TOLNet data.
To Install
python -m pip install --user git+https://github.com/barronh/pytolnet.git
Example
import pytolnet
api = pytolnet.TOLNetAPI()
cldf = api.data_calendar('UAH')
newest_data_id = cldf.index.values[0]
ds = api.to_dataset(newest_data_id)
print(ds.to_dataframe().reset_index().describe())
# time altitude derived_ozone
# count 174096 174096.00000 63538.000000
# mean 2023-08-16 19:17:36.874643968 7.72500 48.525455
# min 2023-08-16 13:06:59 0.30000 0.015444
# 25% 2023-08-16 16:10:39 4.01250 40.799999
# 50% 2023-08-16 19:18:37 7.72500 47.500000
# 75% 2023-08-16 22:24:22 11.43750 55.299999
# max 2023-08-17 01:31:57 15.15000 100.000000
# std NaN 4.29549 13.209246
- class pytolnet.TOLNetAPI(token='anonymous', cache='.', root='https://tolnet.larc.nasa.gov/api')[source]
Bases:
object
- data_calendar(igname=None, igid=None, product_type='4', processing_type='1,2', file_type='1', ascending=False)[source]
Retrieve a data calendar.
- Parameters:
igname (str or None) – Instruments Group name (see instruments_group)
igid (int or None) – Instruments Group id (see instruments_group); supersedes igname. If igname and igid are None, returns calendar from all instruments
product_type (int or str) – Defaults to 4 (HIRES), which is the supported data to be read. Other formats (5=CALVAL; 6=CLIM) are not tested. Remaining formats (7=gridded; 8=legacy) not likely to work.
processing_type (int or str) – Defaults to ‘1,2’ (central,inhouse). Unprocessed (3) is not yet supported.
file_type (int or str) – Defaults to ‘1’ (HDF GEOMS). See file_types for other options.
- Returns:
caldf – DataFrame of data by date
- Return type:
pandas.DataFrame
Example
import pytolnet api = pytolnet.TOLNetAPI() cldf = api.data_calendar('UAH') print(cldf.columns) # 'start_data_date', 'public', 'near_real_time', 'isAccessible'
- get_product_type4(id, cache=None, overwrite=False)[source]
Acquire data from product_type=4 and return it as an xarray.Dataset Same as to_dataset(…, product_type=4)
- Parameters:
id (int) – Must come from data with product_type=4
cache (str) – Path to keep cahed files
overwrite (bool) – If False (default), use cached files in cache folder. If True, remake all files
- Returns:
ds – Dataset for file requested
- Return type:
xarray.Dataset
- get_product_type5(id, cache=None, overwrite=False)[source]
Product type 5 has the same format as 4, so this is a thin wrapper.
Same as to_dataset(…, product_type=5)
- get_product_type6(id, cache=None, overwrite=False)[source]
Product type 6 has the same format as 4, so this is a thin wrapper.
Same as to_dataset(…, product_type=5)
- instruments_groups()[source]
- Returns:
igdf – Instrument groups dataframe
- Return type:
pandas.DataFrame
- processing_types()[source]
- Returns:
ptdf – Processing types dataframe
- Return type:
pandas.DataFrame
- set_token(token=None)[source]
- Parameters:
token (str) – Token to use for access. Use ‘anonymous’ if you don’t have one. Use None if you want to be prompted
- to_dataset(id, cache=None, overwrite=False, product_type=4)[source]
Acquire data from product_type and return it as an xarray.Dataset
- Parameters:
id (int) – Must come from data with product_type=4
cache (str) – Path to keep cahed files
overwrite (bool) – If False (default), use cached files in cache folder. If True, remake all files
product_type (int) – Currently supports 4, 5 and 6 (all same)
- Returns:
ds – Dataset for file requested
- Return type:
xarray.Dataset
Example
import pytolnet api = pytolnet.TOLNetAPI() ds = api.to_dataset(2115)