Skip to content

First iteration of the NMDB.eu data collection function

Daniel Power requested to merge development into main

Neutron Monitor Database (NMDB) function for collecting data

This function collects data from the NMDB.eu service. Tests are included. The main purpose is to collect neutron data for the intensity correction function. The main class is NMDBDataHandler() which is initiated using the NMDBConfig() class. For example:

from cosmosbase.ancillary_data_collection.nmdb_data_collection import (
    NMDBConfig,
    NMDBDataHandler,
)

config = NMDBConfig(start_date_wanted="2015-10-10", end_date_wanted="2015-10-10", station="JUNG")
handler = NMDBDataHandler(config)

handler.collect_nmdb_data()

There are defaults in the NMDBConfig class. This means a user only needs to input the start_date_wanted and end_date_wanted values if desired. The station will default to "JUNG" which represents the Jungfraujoch station, hourly data will be collected and it will be sourced from the revori table (see www.NMDB.eu for more information).

The features:

  • It will collect data from NMDB.eu using the http system and parse it into a DataFrame with a pandas.DateTime index and a single column called count.
  • It will create a cache of the data to prevent overloading the NMDB.eu server with unnecessary requests.
  • It will check if extra data is needed and only download whats needed, given the current cache, and will append and format the cached data.
  • The cache folder is identified using PlatformDirs which means it is in the default location of whichever OS the code is run on. There is an option to delete cache data if necessary in case a lot of data is downloaded.

TODO

  • Fully implement the resolution selection to account for the way NMDB.eu works. When selecting data <10min resolution for a period of say one year, it defaults resolution to 30mins. This requires a loop of some kind (see Corny/Neptoon).

Merge request reports