geospacelab 0.9.3__py3-none-any.whl → 0.9.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geospacelab/__init__.py +1 -1
- geospacelab/datahub/sources/cdaweb/dmsp/ssusi/__init__.py +0 -0
- geospacelab/datahub/sources/cdaweb/dmsp/ssusi/edr_aur/__init__.py +234 -0
- geospacelab/datahub/sources/cdaweb/dmsp/ssusi/edr_aur/downloader.py +93 -0
- geospacelab/datahub/sources/cdaweb/dmsp/ssusi/edr_aur/loader.py +112 -0
- geospacelab/datahub/sources/cdaweb/dmsp/ssusi/edr_aur/variable_config.py +139 -0
- {geospacelab-0.9.3.dist-info → geospacelab-0.9.4.dist-info}/METADATA +1 -1
- {geospacelab-0.9.3.dist-info → geospacelab-0.9.4.dist-info}/RECORD +11 -6
- {geospacelab-0.9.3.dist-info → geospacelab-0.9.4.dist-info}/WHEEL +0 -0
- {geospacelab-0.9.3.dist-info → geospacelab-0.9.4.dist-info}/licenses/LICENSE +0 -0
- {geospacelab-0.9.3.dist-info → geospacelab-0.9.4.dist-info}/top_level.txt +0 -0
geospacelab/__init__.py
CHANGED
|
@@ -6,7 +6,7 @@ __author__ = "Lei Cai"
|
|
|
6
6
|
__copyright__ = "Copyright 2021, GeospaceLAB"
|
|
7
7
|
__credits__ = ["Lei Cai"]
|
|
8
8
|
__license__ = "BSD-3-Clause License"
|
|
9
|
-
__version__ = "0.9.
|
|
9
|
+
__version__ = "0.9.4"
|
|
10
10
|
__maintainer__ = "Lei Cai"
|
|
11
11
|
__email__ = "lei.cai@oulu.fi"
|
|
12
12
|
__status__ = "Developing"
|
|
File without changes
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Licensed under the BSD 3-Clause License
|
|
2
|
+
# Copyright (C) 2021 GeospaceLab (geospacelab)
|
|
3
|
+
# Author: Lei Cai, Space Physics and Astronomy, University of Oulu
|
|
4
|
+
|
|
5
|
+
import datetime
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
import geospacelab.datahub as datahub
|
|
10
|
+
from geospacelab.datahub import DatabaseModel, FacilityModel, InstrumentModel, ProductModel
|
|
11
|
+
from geospacelab.datahub.sources.cdaweb import cdaweb_database
|
|
12
|
+
from geospacelab.config import prf
|
|
13
|
+
import geospacelab.toolbox.utilities.pydatetime as dttool
|
|
14
|
+
import geospacelab.toolbox.utilities.pybasic as basic
|
|
15
|
+
import geospacelab.toolbox.utilities.pylogging as mylog
|
|
16
|
+
from geospacelab.datahub.sources.cdaweb.dmsp.ssusi.edr_aur.loader import Loader as default_Loader
|
|
17
|
+
from geospacelab.datahub.sources.cdaweb.dmsp.ssusi.edr_aur.downloader import Downloader as default_Downloader
|
|
18
|
+
import geospacelab.datahub.sources.cdaweb.dmsp.ssusi.edr_aur.variable_config as var_config
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
default_dataset_attrs = {
|
|
22
|
+
'database': cdaweb_database,
|
|
23
|
+
'facility': 'DMSP',
|
|
24
|
+
'instrument': 'SSUSI',
|
|
25
|
+
'product': 'EDR_AUR',
|
|
26
|
+
'data_file_ext': 'nc',
|
|
27
|
+
'data_root_dir': prf.datahub_data_root_dir / 'CDAWeb' / 'DMSP' / 'SSUSI' / 'EDR_AUR',
|
|
28
|
+
'allow_load': True,
|
|
29
|
+
'allow_download': True,
|
|
30
|
+
'data_search_recursive': False,
|
|
31
|
+
'label_fields': ['database', 'facility', 'instrument', 'product'],
|
|
32
|
+
'time_clip': False,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
default_variable_names = [
|
|
36
|
+
'DATETIME', 'STARTING_TIME', 'STOPPING_TIME',
|
|
37
|
+
'GRID_MLAT', 'GRID_MLON', 'GRID_MLT', 'GRID_UT',
|
|
38
|
+
'GRID_AUR_1216', 'GRID_AUR_1304', 'GRID_AUR_1356', 'GRID_AUR_LBHS', 'GRID_AUR_LBHL',
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
# default_data_search_recursive = True
|
|
42
|
+
|
|
43
|
+
default_attrs_required = []
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class Dataset(datahub.DatasetSourced):
|
|
47
|
+
def __init__(self, **kwargs):
|
|
48
|
+
kwargs = basic.dict_set_default(kwargs, **default_dataset_attrs)
|
|
49
|
+
|
|
50
|
+
super().__init__(**kwargs)
|
|
51
|
+
|
|
52
|
+
self.database = kwargs.pop('database', 'CDAWeb')
|
|
53
|
+
self.facility = kwargs.pop('facility', 'DMSP')
|
|
54
|
+
self.instrument = kwargs.pop('instrument', 'SSUSI')
|
|
55
|
+
self.product = kwargs.pop('product', 'EDR-EUR')
|
|
56
|
+
self.allow_download = kwargs.pop('allow_download', True)
|
|
57
|
+
|
|
58
|
+
self.sat_id = kwargs.pop('sat_id', '')
|
|
59
|
+
self.orbit_id = kwargs.pop('orbit_id', None)
|
|
60
|
+
self.pole = kwargs.pop('pole', '')
|
|
61
|
+
|
|
62
|
+
self.metadata = None
|
|
63
|
+
|
|
64
|
+
allow_load = kwargs.pop('allow_load', False)
|
|
65
|
+
|
|
66
|
+
# self.config(**kwargs)
|
|
67
|
+
|
|
68
|
+
if self.loader is None:
|
|
69
|
+
self.loader = default_Loader
|
|
70
|
+
|
|
71
|
+
if self.downloader is None:
|
|
72
|
+
self.downloader = default_Downloader
|
|
73
|
+
|
|
74
|
+
self._validate_attrs()
|
|
75
|
+
|
|
76
|
+
if allow_load:
|
|
77
|
+
self.load_data()
|
|
78
|
+
|
|
79
|
+
def _validate_attrs(self):
|
|
80
|
+
for attr_name in default_attrs_required:
|
|
81
|
+
attr = getattr(self, attr_name)
|
|
82
|
+
if not str(attr):
|
|
83
|
+
mylog.StreamLogger.warning("The parameter {} is required before loading data!".format(attr_name))
|
|
84
|
+
|
|
85
|
+
def label(self, **kwargs):
|
|
86
|
+
label = super().label()
|
|
87
|
+
return label
|
|
88
|
+
|
|
89
|
+
def load_data(self, **kwargs):
|
|
90
|
+
self.check_data_files(**kwargs)
|
|
91
|
+
|
|
92
|
+
self._set_default_variables(
|
|
93
|
+
default_variable_names,
|
|
94
|
+
configured_variables=var_config.configured_variables
|
|
95
|
+
)
|
|
96
|
+
for file_path in self.data_file_paths:
|
|
97
|
+
try:
|
|
98
|
+
load_obj = self.loader(file_path, file_type=self.product.lower(), pole=self.pole)
|
|
99
|
+
except Exception as e:
|
|
100
|
+
mylog.StreamLogger.warning(("Cannot load the data file: {}".format(file_path)))
|
|
101
|
+
print(e)
|
|
102
|
+
for var_name in self._variables.keys():
|
|
103
|
+
if var_name == 'EMISSION_SPECTRA':
|
|
104
|
+
self._variables[var_name].value = load_obj.variables[var_name]
|
|
105
|
+
continue
|
|
106
|
+
if var_name in ['DATETIME', 'STARTING_TIME', 'STOPPING_TIME']:
|
|
107
|
+
value = np.array([load_obj.variables[var_name]])[np.newaxis, :]
|
|
108
|
+
else:
|
|
109
|
+
value = np.empty((1, ), dtype=object)
|
|
110
|
+
value[0] = load_obj.variables[var_name]
|
|
111
|
+
# value = load_obj.variables[var_name][np.newaxis, ::]
|
|
112
|
+
self._variables[var_name].join(value)
|
|
113
|
+
|
|
114
|
+
self.orbit_id = load_obj.metadata['ORBIT_ID']
|
|
115
|
+
# self.select_beams(field_aligned=True)
|
|
116
|
+
if self.time_clip:
|
|
117
|
+
self.time_filter_by_range()
|
|
118
|
+
|
|
119
|
+
def get_time_ind(self, ut, time_res=20*60, var_datetime_name='DATETIME', edge_cutoff=False, **kwargs):
|
|
120
|
+
ind = super().get_time_ind(ut, time_res=time_res, var_datetime_name=var_datetime_name, edge_cutoff=edge_cutoff, **kwargs)
|
|
121
|
+
return ind
|
|
122
|
+
|
|
123
|
+
def search_data_files(self, **kwargs):
|
|
124
|
+
dt_fr_1 = self.dt_fr - datetime.timedelta(hours=3)
|
|
125
|
+
dt_to_1 = self.dt_to + datetime.timedelta(hours=3)
|
|
126
|
+
|
|
127
|
+
diff_days = dttool.get_diff_days(dt_fr_1, dt_to_1)
|
|
128
|
+
|
|
129
|
+
dt0 = dttool.get_start_of_the_day(dt_fr_1)
|
|
130
|
+
for i in range(diff_days + 1):
|
|
131
|
+
thisday = dt0 + datetime.timedelta(days=i)
|
|
132
|
+
initial_file_dir = kwargs.pop('initial_file_dir', None)
|
|
133
|
+
if initial_file_dir is None:
|
|
134
|
+
initial_file_dir = self.data_root_dir / self.sat_id.upper() / str(thisday.year) /thisday.strftime("%Y%m%d")
|
|
135
|
+
|
|
136
|
+
file_patterns = [
|
|
137
|
+
'dmsp' + self.sat_id.lower(),
|
|
138
|
+
'edr-aurora',
|
|
139
|
+
thisday.strftime("%Y%j") + 'T',
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
if self.orbit_id is not None:
|
|
143
|
+
file_patterns.extend(['REV', self.orbit_id])
|
|
144
|
+
multiple_files = False
|
|
145
|
+
else:
|
|
146
|
+
multiple_files = True
|
|
147
|
+
# remove empty str
|
|
148
|
+
file_patterns = [pattern for pattern in file_patterns if str(pattern)]
|
|
149
|
+
|
|
150
|
+
search_pattern = '*' + '*'.join(file_patterns) + '*'
|
|
151
|
+
|
|
152
|
+
done = super().search_data_files(
|
|
153
|
+
initial_file_dir=initial_file_dir,
|
|
154
|
+
search_pattern=search_pattern,
|
|
155
|
+
allow_multiple_files=multiple_files,
|
|
156
|
+
)
|
|
157
|
+
if done and self.orbit_id is not None:
|
|
158
|
+
return True
|
|
159
|
+
|
|
160
|
+
# Validate file paths
|
|
161
|
+
|
|
162
|
+
if not done and self.allow_download:
|
|
163
|
+
done = self.download_data(dt_fr=thisday, dt_to=thisday)
|
|
164
|
+
if done:
|
|
165
|
+
done = super().search_data_files(
|
|
166
|
+
initial_file_dir=initial_file_dir,
|
|
167
|
+
search_pattern=search_pattern,
|
|
168
|
+
allow_multiple_files=multiple_files
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
return done
|
|
172
|
+
|
|
173
|
+
def download_data(self, dt_fr=None, dt_to=None):
|
|
174
|
+
if dt_fr is None:
|
|
175
|
+
dt_fr = self.dt_fr
|
|
176
|
+
if dt_to is None:
|
|
177
|
+
dt_to = self.dt_to
|
|
178
|
+
download_obj = self.downloader(
|
|
179
|
+
dt_fr, dt_to,
|
|
180
|
+
orbit_id=self.orbit_id, sat_id=self.sat_id,
|
|
181
|
+
)
|
|
182
|
+
return download_obj.done
|
|
183
|
+
|
|
184
|
+
@property
|
|
185
|
+
def database(self):
|
|
186
|
+
return self._database
|
|
187
|
+
|
|
188
|
+
@database.setter
|
|
189
|
+
def database(self, value):
|
|
190
|
+
if isinstance(value, str):
|
|
191
|
+
self._database = DatabaseModel(value)
|
|
192
|
+
elif issubclass(value.__class__, DatabaseModel):
|
|
193
|
+
self._database = value
|
|
194
|
+
else:
|
|
195
|
+
raise TypeError
|
|
196
|
+
|
|
197
|
+
@property
|
|
198
|
+
def product(self):
|
|
199
|
+
return self._product
|
|
200
|
+
|
|
201
|
+
@product.setter
|
|
202
|
+
def product(self, value):
|
|
203
|
+
if isinstance(value, str):
|
|
204
|
+
self._product = ProductModel(value)
|
|
205
|
+
elif issubclass(value.__class__, ProductModel):
|
|
206
|
+
self._product = value
|
|
207
|
+
else:
|
|
208
|
+
raise TypeError
|
|
209
|
+
|
|
210
|
+
@property
|
|
211
|
+
def facility(self):
|
|
212
|
+
return self._facility
|
|
213
|
+
|
|
214
|
+
@facility.setter
|
|
215
|
+
def facility(self, value):
|
|
216
|
+
if isinstance(value, str):
|
|
217
|
+
self._facility = FacilityModel(value)
|
|
218
|
+
elif issubclass(value.__class__, FacilityModel):
|
|
219
|
+
self._facility = value
|
|
220
|
+
else:
|
|
221
|
+
raise TypeError
|
|
222
|
+
|
|
223
|
+
@property
|
|
224
|
+
def instrument(self):
|
|
225
|
+
return self._instrument
|
|
226
|
+
|
|
227
|
+
@instrument.setter
|
|
228
|
+
def instrument(self, value):
|
|
229
|
+
if isinstance(value, str):
|
|
230
|
+
self._instrument = InstrumentModel(value)
|
|
231
|
+
elif issubclass(value.__class__, InstrumentModel):
|
|
232
|
+
self._instrument = value
|
|
233
|
+
else:
|
|
234
|
+
raise TypeError
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import pathlib
|
|
3
|
+
import copy
|
|
4
|
+
|
|
5
|
+
import geospacelab.toolbox.utilities.pydatetime as dttool
|
|
6
|
+
import geospacelab.toolbox.utilities.pylogging as mylog
|
|
7
|
+
from geospacelab.config import prf
|
|
8
|
+
from geospacelab.datahub.sources.cdaweb.downloader import Downloader as DownloaderBase
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Downloader(DownloaderBase):
|
|
12
|
+
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
dt_fr=None, dt_to=None,
|
|
16
|
+
sat_id=None,
|
|
17
|
+
orbit_id=None,
|
|
18
|
+
direct_download=True,
|
|
19
|
+
force_download=False,
|
|
20
|
+
data_file_root_dir = None,
|
|
21
|
+
dry_run=False,
|
|
22
|
+
):
|
|
23
|
+
product = 'EDR_AUR'
|
|
24
|
+
if data_file_root_dir is None:
|
|
25
|
+
data_file_root_dir = prf.datahub_data_root_dir / 'CDAWeb' / 'DMSP' / 'SSUSI' /product / sat_id.upper()
|
|
26
|
+
self.sat_id = sat_id
|
|
27
|
+
self.orbit_id = orbit_id
|
|
28
|
+
self.source_subdirs = ['dmsp', 'dmsp'+self.sat_id.lower(), 'ssusi', 'data', 'edr-aurora']
|
|
29
|
+
|
|
30
|
+
super().__init__(
|
|
31
|
+
dt_fr, dt_to,
|
|
32
|
+
data_file_root_dir=data_file_root_dir,
|
|
33
|
+
direct_download=direct_download,force_download=force_download,dry_run=dry_run
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def search_from_http(self, file_name_patterns=None, allow_multiple_files=True):
|
|
38
|
+
|
|
39
|
+
dt_fr_1 = self.dt_fr - datetime.timedelta(hours=3)
|
|
40
|
+
dt_to_1 = self.dt_to + datetime.timedelta(hours=3)
|
|
41
|
+
diff_days = dttool.get_diff_days(dt_fr_1, dt_to_1)
|
|
42
|
+
dt0 = dttool.get_start_of_the_day(dt_fr_1)
|
|
43
|
+
source_file_paths = []
|
|
44
|
+
for nd in range(diff_days + 1):
|
|
45
|
+
this_day = dt0 + datetime.timedelta(days=nd)
|
|
46
|
+
doy = dttool.get_doy(this_day)
|
|
47
|
+
sdoy = '{:03d}'.format(doy)
|
|
48
|
+
subdirs = copy.deepcopy(self.source_subdirs)
|
|
49
|
+
subdirs.extend(
|
|
50
|
+
[str(this_day.year), sdoy]
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if self.orbit_id is None:
|
|
54
|
+
file_name_patterns = [
|
|
55
|
+
'dmsp' + self.sat_id.lower(),
|
|
56
|
+
'ssusi',
|
|
57
|
+
'edr-aurora',
|
|
58
|
+
this_day.strftime("%Y") + sdoy + 'T',
|
|
59
|
+
'.nc'
|
|
60
|
+
]
|
|
61
|
+
else:
|
|
62
|
+
file_name_patterns = [
|
|
63
|
+
'dmsp' + self.sat_id.lower(),
|
|
64
|
+
'ssusi',
|
|
65
|
+
'edr-aurora',
|
|
66
|
+
'REV',
|
|
67
|
+
self.orbit_id,
|
|
68
|
+
'.nc'
|
|
69
|
+
]
|
|
70
|
+
paths = super().search_from_http(subdirs=subdirs, file_name_patterns=file_name_patterns)
|
|
71
|
+
source_file_paths.extend(paths)
|
|
72
|
+
return source_file_paths
|
|
73
|
+
|
|
74
|
+
def save_file_from_http(self, url, file_dir=None, file_name=None):
|
|
75
|
+
|
|
76
|
+
sy = url.split('/')[-3]
|
|
77
|
+
sdoy = url.split('/')[-2]
|
|
78
|
+
year = int(sy)
|
|
79
|
+
this_day = dttool.convert_doy_to_datetime(year, int(sdoy))
|
|
80
|
+
if file_dir is None:
|
|
81
|
+
file_dir = self.data_file_root_dir / sy / this_day.strftime("%Y%m%d")
|
|
82
|
+
super().save_file_from_http(url, file_dir=file_dir)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
if __name__ == "__main__":
|
|
87
|
+
downloader = Downloader(
|
|
88
|
+
dt_fr = datetime.datetime(2011, 1, 6),
|
|
89
|
+
dt_to = datetime.datetime(2011, 1, 6, 12),
|
|
90
|
+
sat_id='F17',
|
|
91
|
+
orbit_id='21523',
|
|
92
|
+
dry_run=False,
|
|
93
|
+
)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Licensed under the BSD 3-Clause License
|
|
2
|
+
# Copyright (C) 2021 GeospaceLab (geospacelab)
|
|
3
|
+
# Author: Lei Cai, Space Physics and Astronomy, University of Oulu
|
|
4
|
+
|
|
5
|
+
import netCDF4
|
|
6
|
+
import datetime
|
|
7
|
+
import numpy as np
|
|
8
|
+
import geospacelab.toolbox.utilities.pydatetime as dttool
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Loader(object):
|
|
12
|
+
|
|
13
|
+
def __init__(self, file_path, file_type='edr-aur', pole='N'):
|
|
14
|
+
|
|
15
|
+
self.variables = {}
|
|
16
|
+
self.metadata = {}
|
|
17
|
+
self.file_path = file_path
|
|
18
|
+
self.file_type = file_type
|
|
19
|
+
self.pole = pole
|
|
20
|
+
|
|
21
|
+
self.load_data()
|
|
22
|
+
|
|
23
|
+
def load_data(self):
|
|
24
|
+
dataset = netCDF4.Dataset(self.file_path)
|
|
25
|
+
variables = {}
|
|
26
|
+
metadata = {}
|
|
27
|
+
|
|
28
|
+
if self.pole == 'N':
|
|
29
|
+
pole = self.pole
|
|
30
|
+
pole_str = 'NORTH'
|
|
31
|
+
elif self.pole == 'S':
|
|
32
|
+
pole = self.pole
|
|
33
|
+
pole_str = 'SOUTH'
|
|
34
|
+
else:
|
|
35
|
+
raise ValueError
|
|
36
|
+
# Time and Position
|
|
37
|
+
# sectime = int(np.array(dataset.variables['TIME']).flatten()[0])
|
|
38
|
+
# doy = int(np.array(dataset.variables['DOY']).flatten()[0])
|
|
39
|
+
# year = int(np.array(dataset.variables['YEAR']).flatten()[0])
|
|
40
|
+
# dt0 = dttool.convert_doy_to_datetime(year, doy)
|
|
41
|
+
starting_time = datetime.datetime.strptime(dataset.STARTING_TIME, "%Y%j%H%M%S")
|
|
42
|
+
variables['STARTING_TIME'] = starting_time
|
|
43
|
+
stopping_time = datetime.datetime.strptime(dataset.STOPPING_TIME, "%Y%j%H%M%S")
|
|
44
|
+
variables['STOPPING_TIME'] = stopping_time
|
|
45
|
+
dt0 = dttool.get_start_of_the_day(starting_time)
|
|
46
|
+
|
|
47
|
+
variables['SC_LAT'] = np.array(dataset.variables['LATITUDE'])
|
|
48
|
+
variables['SC_LON'] = np.array(dataset.variables['LONGITUDE'])
|
|
49
|
+
variables['SC_ALT'] = np.array(dataset.variables['ALTITUDE'])
|
|
50
|
+
|
|
51
|
+
variables['GRID_MLAT'] = np.array(dataset.variables['LATITUDE_GEOMAGNETIC_GRID_MAP'])
|
|
52
|
+
variables['GRID_MLON'] = np.array(
|
|
53
|
+
dataset.variables['LONGITUDE_GEOMAGNETIC_' + pole_str + '_GRID_MAP'])
|
|
54
|
+
variables['GRID_MLT'] = np.array(dataset.variables['MLT_GRID_MAP'])
|
|
55
|
+
if self.pole == 'S':
|
|
56
|
+
variables['GRID_MLAT'] = - variables['GRID_MLAT']
|
|
57
|
+
variables['GRID_UT'] = np.array(dataset.variables['UT_' + pole])
|
|
58
|
+
lat = np.array(variables['GRID_MLAT'])
|
|
59
|
+
ut = np.array(variables['GRID_UT'])
|
|
60
|
+
lat = np.where(ut == 0, np.nan, lat)
|
|
61
|
+
if self.pole == 'N':
|
|
62
|
+
ind_mid_t = np.where(lat == np.nanmax(lat.flatten()))
|
|
63
|
+
else:
|
|
64
|
+
ind_mid_t = np.where(lat == np.nanmin(lat.flatten()))
|
|
65
|
+
sectime0 = variables['GRID_UT'][ind_mid_t][0] * 3600
|
|
66
|
+
|
|
67
|
+
diff_days = dttool.get_diff_days(starting_time, stopping_time)
|
|
68
|
+
if diff_days > 0 and sectime0 < 0.5 * 86400.:
|
|
69
|
+
dt = dt0 + datetime.timedelta(seconds=int(sectime0 + 86400))
|
|
70
|
+
else:
|
|
71
|
+
dt = dt0 + datetime.timedelta(seconds=int(sectime0))
|
|
72
|
+
variables['DATETIME'] = dt
|
|
73
|
+
|
|
74
|
+
invalid_ut_inds = np.where(ut == 0)
|
|
75
|
+
# Auroral map, #colors: 0: '1216', 1: '1304', 2: '1356', 3: 'LBHS', 4: 'LBHL'.
|
|
76
|
+
variables['EMISSION_SPECTRA'] = ['1216', '1304', '1356', 'LBHS', 'LBHL']
|
|
77
|
+
disk_aur = np.array(dataset.variables['DISK_RADIANCEDATA_INTENSITY_' + pole_str])
|
|
78
|
+
# disk_aur[:, invalid_ut_inds] = np.nan
|
|
79
|
+
disk_aur[disk_aur <= 0] = 0.1
|
|
80
|
+
variables['GRID_AUR_1216'] = disk_aur[0, ::]
|
|
81
|
+
variables['GRID_AUR_1216'][invalid_ut_inds] = np.nan
|
|
82
|
+
variables['GRID_AUR_1304'] = disk_aur[1, ::]
|
|
83
|
+
variables['GRID_AUR_1304'][invalid_ut_inds] = np.nan
|
|
84
|
+
variables['GRID_AUR_1356'] = disk_aur[2, ::]
|
|
85
|
+
variables['GRID_AUR_1356'][invalid_ut_inds] = np.nan
|
|
86
|
+
variables['GRID_AUR_LBHS'] = disk_aur[3, ::]
|
|
87
|
+
variables['GRID_AUR_LBHS'][invalid_ut_inds] = np.nan
|
|
88
|
+
variables['GRID_AUR_LBHL'] = disk_aur[4, ::]
|
|
89
|
+
variables['GRID_AUR_LBHL'][invalid_ut_inds] = np.nan
|
|
90
|
+
|
|
91
|
+
# Auroral oval boundary
|
|
92
|
+
variables['AOB_EQ_MLAT'] = np.array(dataset.variables[pole_str + '_GEOMAGNETIC_LATITUDE'])
|
|
93
|
+
variables['AOB_EQ_MLON'] = np.array(dataset.variables[pole_str + '_GEOMAGNETIC_LONGITUDE'])
|
|
94
|
+
variables['AOB_EQ_MLT'] = np.array(dataset.variables[pole_str + '_MAGNETIC_LOCAL_TIME'])
|
|
95
|
+
|
|
96
|
+
variables['AOB_PL_MLAT'] = np.array(dataset.variables[pole_str + '_POLAR_GEOMAGNETIC_LATITUDE'])
|
|
97
|
+
variables['AOB_PL_MLON'] = np.array(dataset.variables[pole_str + '_POLAR_GEOMAGNETIC_LONGITUDE'])
|
|
98
|
+
variables['AOB_PL_MLT'] = np.array(dataset.variables[pole_str + '_POLAR_MAGNETIC_LOCAL_TIME'])
|
|
99
|
+
|
|
100
|
+
variables['MAOB_EQ_MLAT'] = np.array(dataset.variables['MODEL_' + pole_str + '_GEOMAGNETIC_LATITUDE'])
|
|
101
|
+
variables['MAOB_EQ_MLON'] = np.array(dataset.variables['MODEL_' + pole_str + '_GEOMAGNETIC_LONGITUDE'])
|
|
102
|
+
variables['MAOB_EQ_MLT'] = np.array(dataset.variables['MODEL_' + pole_str + '_MAGNETIC_LOCAL_TIME'])
|
|
103
|
+
|
|
104
|
+
variables['MAOB_PL_MLAT'] = np.array(dataset.variables['MODEL_' + pole_str + '_POLAR_GEOMAGNETIC_LATITUDE'])
|
|
105
|
+
variables['MAOB_PL_MLON'] = np.array(dataset.variables['MODEL_' + pole_str + '_POLAR_GEOMAGNETIC_LONGITUDE'])
|
|
106
|
+
variables['MAOB_PL_MLT'] = np.array(dataset.variables['MODEL_' + pole_str + '_POLAR_MAGNETIC_LOCAL_TIME'])
|
|
107
|
+
|
|
108
|
+
metadata.setdefault('ORBIT_ID', dataset.STARTING_ORBIT_NUMBER)
|
|
109
|
+
dataset.close()
|
|
110
|
+
|
|
111
|
+
self.variables = variables
|
|
112
|
+
self.metadata = metadata
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Licensed under the BSD 3-Clause License
|
|
2
|
+
# Copyright (C) 2021 GeospaceLab (geospacelab)
|
|
3
|
+
# Author: Lei Cai, Space Physics and Astronomy, University of Oulu
|
|
4
|
+
|
|
5
|
+
__author__ = "Lei Cai"
|
|
6
|
+
__copyright__ = "Copyright 2021, GeospaceLab"
|
|
7
|
+
__license__ = "BSD-3-Clause License"
|
|
8
|
+
__email__ = "lei.cai@oulu.fi"
|
|
9
|
+
__docformat__ = "reStructureText"
|
|
10
|
+
|
|
11
|
+
from geospacelab.datahub import VariableModel as Var
|
|
12
|
+
import geospacelab.visualization.mpl.colormaps as cm
|
|
13
|
+
|
|
14
|
+
database = 'jhuapl'
|
|
15
|
+
|
|
16
|
+
timestamps = {
|
|
17
|
+
'DATETIME': 'DATETIME',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
default_colormap = cm.cmap_aurora()
|
|
22
|
+
|
|
23
|
+
default_plot_config = {
|
|
24
|
+
'line': {
|
|
25
|
+
'linestyle': '-',
|
|
26
|
+
'linewidth': 1.5,
|
|
27
|
+
'marker': '',
|
|
28
|
+
'markersize': 3,
|
|
29
|
+
},
|
|
30
|
+
'pcolormesh': {
|
|
31
|
+
'cmap': default_colormap,
|
|
32
|
+
'c_scale': 'log',
|
|
33
|
+
'c_lim': [50, 6000],
|
|
34
|
+
'alpha': 0.9,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
configured_variables = {}
|
|
39
|
+
visual = 'on'
|
|
40
|
+
|
|
41
|
+
depend_0 = {'UT': 'DATETIME'}
|
|
42
|
+
depend_1 = {'AACGM_LAT': 'GRID_MLAT'}
|
|
43
|
+
depend_2 = {'AACGM_LON': 'GRID_MLON'}
|
|
44
|
+
depend_c = {'SPECTRA': 'EMISSION_SPECTRA'}
|
|
45
|
+
|
|
46
|
+
####################################################################################################################
|
|
47
|
+
var_name = 'GRID_AUR_LBHS'
|
|
48
|
+
var = Var(name=var_name, ndim=3, variable_type='scalar', visual=visual)
|
|
49
|
+
# set variable attrs
|
|
50
|
+
var.fullname = 'Auroral emission intensity at LBHS'
|
|
51
|
+
var.label = r'LBHS'
|
|
52
|
+
var.group = 'Emission intensity'
|
|
53
|
+
var.unit = 'R'
|
|
54
|
+
var.depends = {0: depend_0, 1: {'AACGM_LAT': 'GRID_MLAT'}, 2: {'AACGM_LON': 'GRID_MLON'}}
|
|
55
|
+
# set plot attrs
|
|
56
|
+
plot_config = var.visual.plot_config
|
|
57
|
+
plot_config.config(**default_plot_config)
|
|
58
|
+
plot_config.style = '2P'
|
|
59
|
+
# set axis attrs
|
|
60
|
+
axis = var.visual.axis
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
configured_variables[var_name] = var
|
|
64
|
+
|
|
65
|
+
####################################################################################################################
|
|
66
|
+
var_name = 'GRID_AUR_LBHL'
|
|
67
|
+
var = Var(name=var_name, ndim=3, variable_type='scalar', visual=visual)
|
|
68
|
+
# set variable attrs
|
|
69
|
+
var.fullname = 'Auroral emission intensity at LBHL'
|
|
70
|
+
var.label = r'LBHL'
|
|
71
|
+
var.group = 'Emission intensity'
|
|
72
|
+
var.unit = 'R'
|
|
73
|
+
var.depends = {0: depend_0, 1: {'AACGM_LAT': 'GRID_MLAT'}, 2: {'AACGM_LON': 'GRID_MLON'}}
|
|
74
|
+
# set plot attrs
|
|
75
|
+
plot_config = var.visual.plot_config
|
|
76
|
+
plot_config.config(**default_plot_config)
|
|
77
|
+
plot_config.style = '2P'
|
|
78
|
+
# set axis attrs
|
|
79
|
+
axis = var.visual.axis
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
configured_variables[var_name] = var
|
|
83
|
+
|
|
84
|
+
####################################################################################################################
|
|
85
|
+
var_name = 'GRID_AUR_1304'
|
|
86
|
+
var = Var(name=var_name, ndim=3, variable_type='scalar', visual=visual)
|
|
87
|
+
# set variable attrs
|
|
88
|
+
var.fullname = 'Auroral emission intensity at 130.4 nm'
|
|
89
|
+
var.label = r'1304'
|
|
90
|
+
var.group = 'Emission intensity'
|
|
91
|
+
var.unit = 'R'
|
|
92
|
+
var.depends = {0: depend_0, 1: {'AACGM_LAT': 'GRID_MLAT'}, 2: {'AACGM_LON': 'GRID_MLON'}}
|
|
93
|
+
# set plot attrs
|
|
94
|
+
plot_config = var.visual.plot_config
|
|
95
|
+
plot_config.config(**default_plot_config)
|
|
96
|
+
plot_config.style = '2P'
|
|
97
|
+
# set axis attrs
|
|
98
|
+
axis = var.visual.axis
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
configured_variables[var_name] = var
|
|
102
|
+
|
|
103
|
+
####################################################################################################################
|
|
104
|
+
var_name = 'GRID_AUR_1356'
|
|
105
|
+
var = Var(name=var_name, ndim=3, variable_type='scalar', visual=visual)
|
|
106
|
+
# set variable attrs
|
|
107
|
+
var.fullname = 'Auroral emission intensity at 135.6 nm'
|
|
108
|
+
var.label = r'1356'
|
|
109
|
+
var.group = 'Emission intensity'
|
|
110
|
+
var.unit = 'R'
|
|
111
|
+
var.depends = {0: depend_0, 1: {'AACGM_LAT': 'GRID_MLAT'}, 2: {'AACGM_LON': 'GRID_MLON'}}
|
|
112
|
+
# set plot attrs
|
|
113
|
+
plot_config = var.visual.plot_config
|
|
114
|
+
plot_config.config(**default_plot_config)
|
|
115
|
+
plot_config.style = '2P'
|
|
116
|
+
# set axis attrs
|
|
117
|
+
axis = var.visual.axis
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
configured_variables[var_name] = var
|
|
121
|
+
|
|
122
|
+
####################################################################################################################
|
|
123
|
+
var_name = 'GRID_AUR_1216'
|
|
124
|
+
var = Var(name=var_name, ndim=3, variable_type='scalar', visual=visual)
|
|
125
|
+
# set variable attrs
|
|
126
|
+
var.fullname = 'Auroral emission intensity at 121.6 nm'
|
|
127
|
+
var.label = r'1216'
|
|
128
|
+
var.group = 'Emission intensity'
|
|
129
|
+
var.unit = 'R'
|
|
130
|
+
var.depends = {0: depend_0, 1: {'AACGM_LAT': 'GRID_MLAT'}, 2: {'AACGM_LON': 'GRID_MLON'}}
|
|
131
|
+
# set plot attrs
|
|
132
|
+
plot_config = var.visual.plot_config
|
|
133
|
+
plot_config.config(**default_plot_config)
|
|
134
|
+
plot_config.style = '2P'
|
|
135
|
+
# set axis attrs
|
|
136
|
+
axis = var.visual.axis
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
configured_variables[var_name] = var
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
geospacelab/__init__.py,sha256=
|
|
1
|
+
geospacelab/__init__.py,sha256=dJQLIScHKznYuwX0GHMnEKjSwDZfiJ1Lc8IGUD5mONs,800
|
|
2
2
|
geospacelab/config/__init__.py,sha256=D5A0ORTubSaLEXGqPmg-mLH_KNqINicOeeNFqkGpXrk,641
|
|
3
3
|
geospacelab/config/_preferences.py,sha256=DakPjKJQ0VRe2Mgc8bakw585u4N8qVqYYvqnoLdyvH4,4726
|
|
4
4
|
geospacelab/coords/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -24,6 +24,11 @@ geospacelab/datahub/sources/__init__.py,sha256=VZtk8qV_O3LQtUQOOwvBwbqmcI_labsWd
|
|
|
24
24
|
geospacelab/datahub/sources/cdaweb/__init__.py,sha256=fP1ziTZFxTOz-HF07az67F5AfvKJsXdJluEK-NZi6yU,680
|
|
25
25
|
geospacelab/datahub/sources/cdaweb/downloader.py,sha256=NRozp7qlunImJjVjdEX8ol-1l2bhCycrmecnkTGQKoU,5012
|
|
26
26
|
geospacelab/datahub/sources/cdaweb/dmsp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
+
geospacelab/datahub/sources/cdaweb/dmsp/ssusi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
+
geospacelab/datahub/sources/cdaweb/dmsp/ssusi/edr_aur/__init__.py,sha256=uTajV8_7lreuSnoLkNvnNAmSMET-U2PJQ2UEd4AM7IA,8189
|
|
29
|
+
geospacelab/datahub/sources/cdaweb/dmsp/ssusi/edr_aur/downloader.py,sha256=mKNQUfBPXaLo2OapjPiFV-EaZWrMMV8ZbELxe65smss,3184
|
|
30
|
+
geospacelab/datahub/sources/cdaweb/dmsp/ssusi/edr_aur/loader.py,sha256=bQubqbZ54Qh6JzpU6yZmTCma8Qh5S1vTGaFAx3U849A,5322
|
|
31
|
+
geospacelab/datahub/sources/cdaweb/dmsp/ssusi/edr_aur/variable_config.py,sha256=6-BMqRDSAxuND1WtiXD4_70hr4RbmbflvUBT61Fn7s8,4346
|
|
27
32
|
geospacelab/datahub/sources/cdaweb/omni/__init__.py,sha256=Cx34OLYuX_zLIialhXlI6F0x4rXbCWLC7yCYBse6s2c,11529
|
|
28
33
|
geospacelab/datahub/sources/cdaweb/omni/downloader.py,sha256=Rle46rGxWmnM46BMO6hGpZR16vLF6DusYacpH_eMjw0,4129
|
|
29
34
|
geospacelab/datahub/sources/cdaweb/omni/loader.py,sha256=MVxzK9uMtxWK8OjnzHyJD-k0M-Sq7Fk4YbN_CkreQok,3207
|
|
@@ -366,7 +371,7 @@ geospacelab/wrapper/geopack/geopack/t89.py,sha256=zDVNPrmtK1NnNHgohQEPqOOJDsm2Z-
|
|
|
366
371
|
geospacelab/wrapper/geopack/geopack/t96.py,sha256=ktcoo1R7Z3NtkWHENuseu48ub4-JfQGqFV0ZOtd0zH8,65292
|
|
367
372
|
geospacelab/wrapper/geopack/geopack/test_geopack1.md,sha256=dMUY0O1BgZsKpmJ6BLSQ80B6p6DZcB7OceFeyPOlFK0,15324
|
|
368
373
|
geospacelab/wrapper/geopack/geopack/test_geopack1.py,sha256=qjLz6O3BAk3H58IpmxXyftwZTkh3vPGp49C-al4hjf0,6669
|
|
369
|
-
geospacelab-0.9.
|
|
374
|
+
geospacelab-0.9.4.dist-info/licenses/LICENSE,sha256=2yRlwLt4o5Z6OZAGcyvBj-zfFX1Uw7E6CzqODg7khqs,1515
|
|
370
375
|
test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
371
376
|
test/test_ampere.py,sha256=0-HZURubpv1mBK3bJ_qTqx39L1jezgRoU5neXMPYgZQ,2968
|
|
372
377
|
test/test_dmsp_s1.py,sha256=5m_7mjdDGja8ovshNPV3LKW_6q6mIwT9XKqoyRiH79A,3588
|
|
@@ -376,7 +381,7 @@ test/test_omni.py,sha256=Zk1LZozPiY5V0aSRmK6GTQuB01hHn_j2j3Brm6Ea_po,1632
|
|
|
376
381
|
test/test_superdarn.py,sha256=uP55muvXryPzNGHinWkiGv2PxvRs4f9M9h1WIBEBW7k,2846
|
|
377
382
|
test/test_swarm.py,sha256=PDDE9nUshhQpXZbV_ZwcsjbMhI73fRaojTZv9rtRzZE,15568
|
|
378
383
|
test/test_swarm_new.py,sha256=mzhMAx-M9W3Ue5noTyfBx4c3Vtc3b_ZUEvGgL9v8UE4,853
|
|
379
|
-
geospacelab-0.9.
|
|
380
|
-
geospacelab-0.9.
|
|
381
|
-
geospacelab-0.9.
|
|
382
|
-
geospacelab-0.9.
|
|
384
|
+
geospacelab-0.9.4.dist-info/METADATA,sha256=UF8obzWkezokPVpo3Ve55LxRlMH1Px1YtnH7j5RS5IM,24336
|
|
385
|
+
geospacelab-0.9.4.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
|
386
|
+
geospacelab-0.9.4.dist-info/top_level.txt,sha256=98eDwrSNgyQFAtSA06QMP71gw9BzgIj0uvkTudpGly4,12
|
|
387
|
+
geospacelab-0.9.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|