@@ -17,11 +17,14 def cda_get_sample(metadata, start,stop): | |||||
17 | try: |
|
17 | try: | |
18 | variable_id = None |
|
18 | variable_id = None | |
19 | dataset_id = None |
|
19 | dataset_id = None | |
|
20 | drop_cols = [] | |||
20 | for key,value in metadata: |
|
21 | for key,value in metadata: | |
21 | if key == 'VAR_ID': |
|
22 | if key == 'VAR_ID': | |
22 | variable_id = value |
|
23 | variable_id = value | |
23 | elif key == 'DATASET_ID': |
|
24 | elif key == 'DATASET_ID': | |
24 | dataset_id = value |
|
25 | dataset_id = value | |
|
26 | elif key == 'drop_col': | |||
|
27 | drop_cols.append(value) | |||
25 | elif key == 'type': |
|
28 | elif key == 'type': | |
26 | if value == 'vector': |
|
29 | if value == 'vector': | |
27 | ts_type = pysciqlopcore.VectorTimeSerie |
|
30 | ts_type = pysciqlopcore.VectorTimeSerie | |
@@ -31,19 +34,20 def cda_get_sample(metadata, start,stop): | |||||
31 | tstart=datetime.datetime.fromtimestamp(start, tz=timezone.utc) |
|
34 | tstart=datetime.datetime.fromtimestamp(start, tz=timezone.utc) | |
32 | tend=datetime.datetime.fromtimestamp(stop, tz=timezone.utc) |
|
35 | tend=datetime.datetime.fromtimestamp(stop, tz=timezone.utc) | |
33 | df = cd.get_variable(dataset=dataset_id,variable=variable_id,tstart=tstart,tend=tend) |
|
36 | df = cd.get_variable(dataset=dataset_id,variable=variable_id,tstart=tstart,tend=tend) | |
|
37 | if len(df): | |||
|
38 | df = df.drop(columns = drop_cols) | |||
34 | t = np.array([d.timestamp() for d in df.index]) |
|
39 | t = np.array([d.timestamp() for d in df.index]) | |
35 | values = df.values |
|
40 | values = df.values | |
36 | print(values.shape) |
|
|||
37 | return ts_type(t,values) |
|
41 | return ts_type(t,values) | |
38 | except Exception as e: |
|
42 | except Exception as e: | |
39 | print(traceback.format_exc()) |
|
43 | print(traceback.format_exc()) | |
40 |
print("Error in |
|
44 | print("Error in cdaweb.py ",str(e)) | |
41 | return ts_type(default_ctor_args) |
|
45 | return ts_type(default_ctor_args) | |
42 |
|
46 | |||
43 |
|
47 | |||
44 | products = [ |
|
48 | products = [ | |
45 |
("/CDA/Themis/ThA/tha_fgl_gsm", [], [("type"," |
|
49 | ("/CDA/Themis/ThA/tha_fgl_gsm", [], [("type","vector"), ('drop_col','UT__sec'), ("DATASET_ID","THA_L2_FGM"), ("VAR_ID","tha_fgl_gsm")]), | |
46 |
("/CDA/Themis/ThB/thb_fgl_gsm", [], [("type"," |
|
50 | ("/CDA/Themis/ThB/thb_fgl_gsm", [], [("type","vector"), ('drop_col','UT__sec'), ("DATASET_ID","THB_L2_FGM"), ("VAR_ID","thb_fgl_gsm")]), | |
47 |
|
51 | |||
48 | ] |
|
52 | ] | |
49 |
|
53 |
General Comments 0
You need to be logged in to leave comments.
Login now