pysat / pysatSpaceWeather

pysat support for space weather indices and data sets
BSD 3-Clause "New" or "Revised" License
7 stars 5 forks source link

Added LASP predicted Dst #69

Closed aburrell closed 2 years ago

aburrell commented 2 years ago

Description

Addresses #58 by adding the LASP predicted Dst.

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

import pysat
import pysatSpaceWeather as pysat_sw

dst_lasp = pysat.Instrument(inst_module=pysat_sw.instruments.sw_dst, tag='lasp')
dst_lasp.download()
dst_lasp.load()
print(dst_lasp.data)
                                    time   dst
2021-10-23 16:08:21  2021-10-23 16:08:21 -13.3
2021-10-23 16:19:23  2021-10-23 16:19:23 -13.4
2021-10-23 16:29:30  2021-10-23 16:29:30 -13.1
2021-10-23 16:38:43  2021-10-23 16:38:43 -13.1
2021-10-23 16:47:30  2021-10-23 16:47:30 -13.4
...                                  ...   ...
2021-10-27 15:07:59  2021-10-27 15:07:59  -8.5
2021-10-27 15:17:30  2021-10-27 15:17:30  -9.0
2021-10-27 15:27:44  2021-10-27 15:27:44 -10.9
2021-10-27 15:38:01  2021-10-27 15:38:01 -12.1
2021-10-27 15:48:12  2021-10-27 15:48:12 -12.7

[575 rows x 2 columns]

print(dst_lasp.meta['dst'])
units                                                       nT
long_name                                                  Dst
notes        Predicted Dst from real-time ACE or DSCOVR pro...
desc                              Disturbance storm-time index
value_min                                                 -inf
value_max                                                  inf
fill                                                       NaN
children                                                  None
Name: dst, dtype: object

Test Configuration

Checklist:

If this is a release PR, replace the first item of the above checklist with the release checklist on the pysat wiki: https://github.com/pysat/pysat/wiki/Checklist-for-Release

rstoneback commented 2 years ago

I was able to download, load, and plot some data.

In [5]: dst = pysat.Instrument('sw', 'dst', 'lasp')

In [8]: dst.download(pysat.utils.time.today())

In [9]: dst.load(date=pysat.utils.time.today())

In [21]: dst['dst'].plot(title='Dst', ylabel=dst.meta['dst'].units)
Out[21]: <AxesSubplot:title={'center':'Dst'}, ylabel='nT'>

dst_example

rstoneback commented 2 years ago

I did notice a warning some metadata was set to default.

The issue is the 'time' meta. I notice the load is not providing meta for time so I think this may trace to your io.utils pull that adds metadata for the epoch variable.

In [22]: dst.meta.data
Out[22]: 
     units long_name                                              notes                          desc value_min value_max fill
dst     nT       Dst  Predicted Dst from real-time ACE or DSCOVR pro...  Disturbance storm-time index      -inf       inf  NaN
time            time  Metadata set to defaults, as they were missing...                                     NaN       NaN  NaN
aburrell commented 2 years ago

The issue is the 'time' meta. I notice the load is not providing meta for time so I think this may trace to your io.utils pull that adds metadata for the epoch variable.

I am not sure why it would. That just adds it if needed, it doesn't add it by default. pysat shouldn't care if time has metadata or not 😕

rstoneback commented 2 years ago

The issue is the 'time' meta. I notice the load is not providing meta for time so I think this may trace to your io.utils pull that adds metadata for the epoch variable.

I am not sure why it would. That just adds it if needed, it doesn't add it by default. pysat shouldn't care if time has metadata or not 😕

There was an additional 'time' column along with the pandas datetimeindex being passed back from the load_csv_data. I pushed a small change to drop that column.

aburrell commented 2 years ago

Re-requesting review because I poked a bit more and found that I was writing two time columns instead of one.