Skip to content

Commit 95cb999

Browse files
smitharapacesm
andauthored
Add TOLEOS products (#110)
* Making the time variable configurable. * Adding TOLEOS conjunction product (MM_CON_SPH_2_). - 2 datasets: crossover and plane_alignment * Adding Swarm thermosperic density products (DNSxPOD_2_ and DNSxACC_2_) * Adding TOLEOS thermosperic density and cross-wind products (DNSxACC_2_ and WNDxACC_2_) CHAMP, GRACE, and GRACE-FO data * Fix type, SPH to EPH * Convert additional time variables when loading * Add GF_WNDxACC reference * Add docs for TOLEOS * pre-commit autofix * Disable type annotation check --------- Co-authored-by: Martin Paces <[email protected]>
1 parent f15fa07 commit 95cb999

File tree

6 files changed

+247
-41
lines changed

6 files changed

+247
-41
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ repos:
2929
- id: python-check-blanket-noqa
3030
# - id: python-check-blanket-type-ignore
3131
- id: python-no-eval
32-
- id: python-use-type-annotations
32+
# - id: python-use-type-annotations
3333
- id: rst-backticks
3434
- id: rst-directive-colons
3535
- id: rst-inline-touching-normal

docs/available_parameters.rst

+15
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ SW_OPER_PPIxFAC_2F PPI_FAC Midnight Plasmapause Index (PPI)
9696
SW_OPER_PPIxFAC_2F:ID PPI_FAC:ID -> Boundaries of the Small-Scale Field Aligned Currents (SSFAC)
9797
====================== ================ ===================================================================================================
9898

99+
`TOLEOS (Thermosphere Observations from Low-Earth Orbiting Satellites) <https://earth.esa.int/eogateway/activities/toleos>`_ products are provided as follows.
100+
101+
============================== ================ ===================================================================================================
102+
Collection full name Collection type Description
103+
============================== ================ ===================================================================================================
104+
CH_OPER_DNS_ACC_2_ DNS_ACC_CHAMP Thermosphere mass density (CHAMP)
105+
GR_OPER_DNSxACC_2_ DNS_ACC_GRACE Thermosphere mass density (GRACE)
106+
GF_OPER_DNSxACC_2_ DNS_ACC_GFO Thermosphere mass density (GRACE-FO)
107+
CH_OPER_WND_ACC_2_ WND_ACC_CHAMP Thermosphere crosswind (CHAMP)
108+
GR_OPER_WNDxACC_2_ WND_ACC_GRACE Thermosphere crosswind (GRACE)
109+
GF_OPER_WNDxACC_2_ WND_ACC_GFO Thermosphere crosswind (GRACE-FO)
110+
MM_CON_SPH_2_:crossover Conjunction information (times when ground-tracks intersect)
111+
MM_CON_SPH_2_:plane_alignment Conjunction information (times when orbital planes align)
112+
============================== ================ ===================================================================================================
113+
99114
The AUX_OBS collections contain ground magnetic observatory data from `INTERMAGNET <https://intermagnet.github.io/data_conditions.html>`_ and `WDC <http://www.wdc.bgs.ac.uk/>`_. Please note that these data are provided under different usage terms than the ESA data, and must be acknowledged accordingly.
100115

101116
======================== ================ ==============================================================

docs/release_notes.rst

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Changes from 0.11.6 to 0.11.7
99

1010
- Added auxiliaries ``["F107_avg81d", "F107_avg81d_count"]``
1111
- Updated and added ML-calibrated variants of GOCE & GRACE-FO magnetic datasets, ``GO_MAG_ACAL_CORR_ML`` & ``GFx_MAG_ACAL_CORR_ML``
12+
- Added TOLEOS thermosphere products:
13+
14+
- e.g. ``"CH_OPER_DNS_ACC_2_"`` and ``"CH_OPER_WND_ACC_2_"`` from CHAMP and equivalents from GRACE and GRACE-FO
15+
- conjunction information within ``"MM_CON_SPH_2_:crossover"`` and ``"MM_CON_SPH_2_:plane_alignment"``
1216

1317
Changes from 0.11.5 to 0.11.6
1418
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/viresclient/_client.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ def __init__(
261261
logging_level="NO_LOGGING",
262262
server_type=None,
263263
):
264-
265264
self._server_type = server_type
266265

267266
# Check and prompt for token if not already set, then store in config
@@ -278,6 +277,7 @@ def __init__(
278277

279278
self._available = {}
280279
self._collection = None
280+
self._file_options = {} # type-specific file options (e.g., time variable)
281281
self._request_inputs = None
282282
self._request = None
283283
self._templatefiles = {}
@@ -546,7 +546,10 @@ def get_between(
546546
raise TypeError("asynchronous must be set to either True or False")
547547

548548
# Initialise the ReturnedData so that filetype checking is done there
549-
retdatagroup = ReturnedData(filetype=filetype)
549+
retdatagroup = ReturnedData(
550+
filetype=filetype,
551+
file_options=self._file_options,
552+
)
550553

551554
if retdatagroup.filetype not in self._supported_filetypes:
552555
raise TypeError(f"filetype: {filetype} not supported by server")
@@ -588,7 +591,12 @@ def get_between(
588591
)
589592
nchunks = len(intervals)
590593
# Recreate the ReturnedData with the right number of chunks
591-
retdatagroup = ReturnedData(filetype=filetype, N=nchunks, tmpdir=tmpdir)
594+
retdatagroup = ReturnedData(
595+
filetype=filetype,
596+
N=nchunks,
597+
tmpdir=tmpdir,
598+
file_options=self._file_options,
599+
)
592600

593601
def _get_chunk(i, start_time_i, end_time_i, leave_progress_bar=False):
594602
"""Process an individual chunk and update retdatagroup"""

src/viresclient/_client_swarm.py

+148
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@
233233
"EFI_TCT16": (
234234
"https://earth.esa.int/eogateway/documents/20142/37627/swarm-EFI-TII-cross-track-flow-dataset-release-notes.pdf",
235235
),
236+
"DNS_POD": ("https://swarmhandbook.earth.esa.int/catalogue/SW_DNSxPOD_2_",),
237+
"DNS_ACC": ("https://swarmhandbook.earth.esa.int/catalogue/SW_DNSxACC_2_",),
238+
"DNS_ACC_CHAMP": ("https://swarmhandbook.earth.esa.int/catalogue/CH_DNS_ACC_2_",),
239+
"DNS_ACC_GRACE": ("https://swarmhandbook.earth.esa.int/catalogue/GR_DNSxACC_2_",),
240+
"DNS_ACC_GFO": ("https://swarmhandbook.earth.esa.int/catalogue/GF_DNSxACC_2_",),
241+
"WND_ACC_CHAMP": ("https://swarmhandbook.earth.esa.int/catalogue/CH_WND_ACC_2_",),
242+
"WND_ACC_GRACE": ("https://swarmhandbook.earth.esa.int/catalogue/GR_WNDxACC_2_",),
243+
"WND_ACC_GFO": ("https://swarmhandbook.earth.esa.int/catalogue/GF_WNDxACC_2_",),
244+
"MM_CON_EPH_2_": ("https://swarmhandbook.earth.esa.int/catalogue/MM_CON_EPH_2_",),
236245
}
237246
for mission in ("SW", "OR", "CH", "CR", "CO"):
238247
for cadence in ("1M", "4M"):
@@ -493,6 +502,14 @@ class SwarmRequest(ClientRequest):
493502
(("Swarm", "A"), ("Swarm", "B")),
494503
}
495504

505+
FILE_OPTIONS = {
506+
"MM_CON_EPH_2_:crossover": {
507+
"time_variable": "time_1",
508+
"secondary_time_variables": ["time_2"],
509+
},
510+
"MM_CON_EPH_2_:plane_alignment": {"time_variable": "time"},
511+
}
512+
496513
COLLECTIONS = {
497514
"MAG": [
498515
*(f"SW_OPER_MAG{x}_LR_1B" for x in "ABC"),
@@ -635,6 +652,19 @@ class SwarmRequest(ClientRequest):
635652
*(f"SW_OPER_MOD{x}_SC_1B" for x in "ABC"),
636653
*(f"SW_FAST_MOD{x}_SC_1B" for x in "ABC"),
637654
],
655+
# Swarm thermospheric density products:
656+
"DNS_POD": [f"SW_OPER_DNS{spacecraft}POD_2_" for spacecraft in "ABC"],
657+
"DNS_ACC": [f"SW_OPER_DNS{spacecraft}ACC_2_" for spacecraft in "ABC"],
658+
# TOLEOS thermospheric density and crosswind products:
659+
"DNS_ACC_CHAMP": ["CH_OPER_DNS_ACC_2_"],
660+
"DNS_ACC_GRACE": ["GR_OPER_DNS1ACC_2_", "GR_OPER_DNS2ACC_2_"],
661+
"DNS_ACC_GFO": ["GF_OPER_DNS1ACC_2_"], # empty GF_OPER_DNS2ACC_2_ exists
662+
"WND_ACC_CHAMP": ["CH_OPER_WND_ACC_2_"],
663+
"WND_ACC_GRACE": ["GR_OPER_WND1ACC_2_", "GR_OPER_WND2ACC_2_"],
664+
"WND_ACC_GFO": ["GF_OPER_WND1ACC_2_"], # empty GF_OPER_WND2ACC_2_ exists
665+
# TOLEOS conjunctions
666+
"MM_CON_EPH_2_:crossover": ["MM_OPER_CON_EPH_2_:crossover"],
667+
"MM_CON_EPH_2_:plane_alignment": ["MM_OPER_CON_EPH_2_:plane_alignment"],
638668
}
639669

640670
OBS_COLLECTIONS = [
@@ -709,6 +739,16 @@ class SwarmRequest(ClientRequest):
709739
"MIT_TEC:ID": "PT20M",
710740
"PPI_FAC": "PT20M",
711741
"PPI_FAC:ID": "PT20M",
742+
"DNS_POD": "PT30S",
743+
"DNS_ACC": "PT10S",
744+
"DNS_ACC_CHAMP": "PT10S",
745+
"DNS_ACC_GRACE": "PT10S",
746+
"DNS_ACC_GFO": "PT10S",
747+
"WND_ACC_CHAMP": "PT10S",
748+
"WND_ACC_GRACE": "PT10S",
749+
"WND_ACC_GFO": "PT10S",
750+
"MM_CON_EPH_2_:crossover": "PT20M",
751+
"MM_CON_EPH_2_:plane_alignment": "P1D",
712752
}
713753

714754
PRODUCT_VARIABLES = {
@@ -1132,6 +1172,107 @@ class SwarmRequest(ClientRequest):
11321172
"Longitude_QD",
11331173
],
11341174
"MOD_SC": [],
1175+
"DNS_POD": [
1176+
"Height_GD",
1177+
"Latitude_GD",
1178+
"Longitude_GD",
1179+
"Height_GD",
1180+
"local_solar_time",
1181+
"density",
1182+
"density_orbitmean",
1183+
"validity_flag",
1184+
],
1185+
"DNS_ACC": [
1186+
"Height_GD",
1187+
"Latitude_GD",
1188+
"Longitude_GD",
1189+
"Height_GD",
1190+
"density",
1191+
"local_solar_time",
1192+
],
1193+
"DNS_ACC_CHAMP": [
1194+
"Height_GD",
1195+
"Latitude_GD",
1196+
"Longitude_GD",
1197+
"density",
1198+
"density_orbitmean",
1199+
"local_solar_time",
1200+
"validity_flag",
1201+
"validity_flag_orbitmean",
1202+
],
1203+
"DNS_ACC_GRACE": [
1204+
"Height_GD",
1205+
"Latitude_GD",
1206+
"Longitude_GD",
1207+
"density",
1208+
"density_orbitmean",
1209+
"local_solar_time",
1210+
"validity_flag",
1211+
"validity_flag_orbitmean",
1212+
],
1213+
"DNS_ACC_GFO": [
1214+
"Height_GD",
1215+
"Latitude_GD",
1216+
"Longitude_GD",
1217+
"density",
1218+
"density_orbitmean",
1219+
"local_solar_time",
1220+
"validity_flag",
1221+
"validity_flag_orbitmean",
1222+
],
1223+
"WND_ACC_CHAMP": [
1224+
"Height_GD",
1225+
"Latitude_GD",
1226+
"Longitude_GD",
1227+
"crosswind",
1228+
"crosswind_direction",
1229+
"local_solar_time",
1230+
"validity_flag",
1231+
],
1232+
"WND_ACC_GRACE": [
1233+
"Height_GD",
1234+
"Latitude_GD",
1235+
"Longitude_GD",
1236+
"crosswind",
1237+
"crosswind_direction",
1238+
"local_solar_time",
1239+
"validity_flag",
1240+
],
1241+
"WND_ACC_GFO": [
1242+
"Height_GD",
1243+
"Latitude_GD",
1244+
"Longitude_GD",
1245+
"crosswind",
1246+
"crosswind_direction",
1247+
"local_solar_time",
1248+
"validity_flag",
1249+
],
1250+
"MM_CON_EPH_2_:crossover": [
1251+
"time_1",
1252+
"time_2",
1253+
"time_difference",
1254+
"satellite_1",
1255+
"satellite_2",
1256+
"latitude",
1257+
"longitude",
1258+
"altitude_1",
1259+
"altitude_2",
1260+
"magnetic_latitude",
1261+
"magnetic_longitude",
1262+
"local_solar_time_1",
1263+
"local_solar_time_2",
1264+
],
1265+
"MM_CON_EPH_2_:plane_alignment": [
1266+
"time",
1267+
"altitude_1",
1268+
"altitude_2",
1269+
"ltan_1",
1270+
"ltan_2",
1271+
"ltan_rate_1",
1272+
"ltan_rate_2",
1273+
"satellite_1",
1274+
"satellite_2",
1275+
],
11351276
}
11361277

11371278
AUXILIARY_VARIABLES = [
@@ -1559,6 +1700,13 @@ def set_collection(self, *args, verbose=True):
15591700
self._detect_AUX_OBS(collections)
15601701
self._collection_list = collections
15611702
self._request_inputs.set_collections(collections)
1703+
1704+
# type specific file options
1705+
self._file_options = (
1706+
self.FILE_OPTIONS.get(self._available["collections_to_keys"][collection])
1707+
or {}
1708+
)
1709+
15621710
return self
15631711

15641712
def set_products(

0 commit comments

Comments
 (0)