viresclient API

Contents

viresclient API#

Author: Luca Mariani

Abstract: Describe the main classes and methods defined in the viresclient package

Introduction#

The viresclient Python package allows to connect to the VirES server to download Swarm data and data calculated using magnetic models.

Documentation:

Contents#

  • Access token configuration

  • Send requests to the server - SwarmRequest

    • Get the available collections

    • Get the available measurements

    • Get the available auxiliaries

    • Get the available magnetic models

    • Get information about one or mode models

    • Get the orbit number

    • Get times for orbits

    • Set collections

    • Set products

    • Set/clear filters

    • Send request to the server

  • Handle downloaded data - ReturnedData

    • Get the list of source data

    • ReturnedData contents

    • Get type of downloaded data files

    • Get list of magnetic models used during calculations

    • Get list of filters applied to the request

    • Convert ReturnedData to Pandas DataFrame

    • Convert ReturnedData to xarray Dataset

    • Save downloaded data to a file

    • Save downloaded data to multiple files

  • Handle downloaded temporary file - ReturnedDataFile

    • Get NamedTemporaryFile associated to a ReturnedDataFile

    • Get type of the downloaded data file

    • Convert ReturnedDataFile to Pandas DataFrame

    • Convert ReturnedDataFile to xarray Dataset

    • Save ReturnedDataFile object to a file

  • Handle viresclient configuration - ClientConfig

    • Get path of the configuration file

    • Get or set the default URL

    • Set site configuration

    • Get site configuration

    • Save configuration

  • Upload data to the server - DataUpload

    • Upload a file to the server

    • Get the identifier(s) of the uploaded file(s)

    • Get info about the uploaded file

    • Set constant parameters to the uploaded file

    • Get constant parameters

    • Delete a specific uploaded file

    • Delete the uploaded files

TOP

Access token configuration#

Before using the client, you need to set the access token. This can be done using the set_token() function:

set_token(url='https://vires.services/ows', token=None, set_default=False)

Parameters:

  • url (str, optional): server URL (default value: https://vires.services/ows).

  • token (str, optional): token string obtained from the VirES access token management page (https://vires.services/accounts/tokens/). If this parameter is not set, the user is prompted to enter its value interactively.

  • set_default (bool, optional): if True, the server identified by url is configured as default server (default False).

Since the url parameter is by default set to the correct value you don’t need to specify it. You can avoid also to specify the token parameter because this value will be asked interactively. Moreover, setting set_default=True you can configure this URL as default in the configuration file and avoid to specify it while sending requests to the server.

First, the function must be imported from the viresclient package:

from viresclient import set_token

Now it can be executed:

set_token(set_default=True)
Setting access token for https://vires.services/ows...
Generate a token at https://vires.services/accounts/tokens/
No input method available. Unable to set token.

TOP

Send requests to the server - SwarmRequest#

The SwarmRequest object allows to create a request to the server and to download data according to the input parameters.

class SwarmRequest(url=None, username=None, password=None, token=None, config=None, logging_level='NO_LOGGING')

Parameters:

  • url (str, optional): if not provided, the request will be sent to the default URL set in the ~/.viresclient.ini configuration file.

  • username (str, optional): username. The usage of username and password is deprecated and will be removed in future releases.

  • password (str, optional): password. The usage of username and password is deprecated and will be removed in future releases.

  • token (str, optional): token string obtained from the VirES access token management page (https://vires.services/accounts/tokens/). If this parameter is not specified and it is not set in the configuration file, the user is prompted to enter its value interactively.

  • config (str or ClientConfig, optional): viresclient configuration. By default, it is read from ~/.viresclient.ini.

  • logging_level (str, optional): set the logging level. Allowed values are: DEBUG, INFO, WARNING, ERROR, NO_LOGGING (default).

Let’s import the class from the viresclient package:

from viresclient import SwarmRequest

After configuring the access token using the set_token() function (see Access token configuration) , the SwarmRequest object can be created as follows:

request = SwarmRequest()

The access token for the https://vires.services/ows default URL configured in the ~/.viresclient.ini file is automatically retrieved:

[https://vires.services/ows]
token = <token>

[default]
url = https://vires.services/ows

If the default server URL is not configured (i.e. the “default” section is not present), you must specify the server URL:

request = SwarmRequest('https://vires.services/ows')

SwarmRequest object has the following methods:

  • SwarmRequest.available_collections()

  • SwarmRequest.available_measurements()

  • SwarmRequest.available_auxiliaries()

  • SwarmRequest.available_models()

  • SwarmRequest.get_model_info()

  • SwarmRequest.get_orbit_number()

  • SwarmRequest.get_times_for_orbits()

  • SwarmRequest.set_collection()

  • SwarmRequest.set_products()

  • SwarmRequest.set_range_filter()

  • SwarmRequest.clear_range_filter()

  • SwarmRequest.get_between()

TOP

Get the available collections#

Swarm data are organized in collections. Each collection is related to a Swarm file type (e.g. collection SW_OPER_MAGA_LR_1B is related to file type MAGA_LR_1B). The list of the available collections are provided invoking the SwarmRequest.available_collections() method.

SwarmRequest.available_collections(details=True)

Parameters:

  • details (bool, optional): if True (default), the method prints the list of all the available collections and the related details. If False, it returns the available collections as a list.

Example: print the list of the available collections and their details:

# Import SwarmRequest object (this step can be skipped if SwarmRequest has been already imported)
from viresclient import SwarmRequest

# Create the request object
request = SwarmRequest()

# Get the available collections
request.available_collections()
General References:
 Swarm Data Handbook, https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook 
 The Swarm Satellite Constellation Application and Research Facility (SCARF) and Swarm data products, https://doi.org/10.5047/eps.2013.07.001 
 Swarm Science Data Processing and Products (2013), https://link.springer.com/journal/40623/65/11/page/1 
 Special issue “Swarm science results after 2 years in space (2016), https://www.springeropen.com/collections/swsr 
 Earth's Magnetic Field: Understanding Geomagnetic Sources from the Earth's Interior and its Environment (2017), https://link.springer.com/journal/11214/206/1/page/1 

MAG
   SW_OPER_MAGA_LR_1B
   SW_OPER_MAGB_LR_1B
   SW_OPER_MAGC_LR_1B
   SW_FAST_MAGA_LR_1B
   SW_FAST_MAGB_LR_1B
   SW_FAST_MAGC_LR_1B
 https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-1b-product-definitions#MAGX_LR_1B_Product 

MAG_HR
   SW_OPER_MAGA_HR_1B
   SW_OPER_MAGB_HR_1B
   SW_OPER_MAGC_HR_1B
   SW_FAST_MAGA_HR_1B
   SW_FAST_MAGB_HR_1B
   SW_FAST_MAGC_HR_1B
https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-1b-product-definitions#MAGX_HR_1B_Product 

EFI
   SW_OPER_EFIA_LP_1B
   SW_OPER_EFIB_LP_1B
   SW_OPER_EFIC_LP_1B
   SW_FAST_EFIA_LP_1B
   SW_FAST_EFIB_LP_1B
   SW_FAST_EFIC_LP_1B
 https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-1b-product-definitions#EFIX_LP_1B_Product 

EFI_IDM
   SW_PREL_EFIAIDM_2_
   SW_PREL_EFIBIDM_2_
   SW_PREL_EFICIDM_2_
https://earth.esa.int/eogateway/documents/20142/2860886/SLIDEM_Product_Definition.pdf

EFI_TIE
   SW_OPER_EFIATIE_2_
   SW_OPER_EFIBTIE_2_
   SW_OPER_EFICTIE_2_
https://earth.esa.int/eogateway/activities/swarm-ion-temperature-estimation

EFI_TCT02
   SW_EXPT_EFIA_TCT02
   SW_EXPT_EFIB_TCT02
   SW_EXPT_EFIC_TCT02
https://earth.esa.int/eogateway/documents/20142/37627/swarm-EFI-TII-cross-track-flow-dataset-release-notes.pdf

EFI_TCT16
   SW_EXPT_EFIA_TCT16
   SW_EXPT_EFIB_TCT16
   SW_EXPT_EFIC_TCT16
https://earth.esa.int/eogateway/documents/20142/37627/swarm-EFI-TII-cross-track-flow-dataset-release-notes.pdf

IBI
   SW_OPER_IBIATMS_2F
   SW_OPER_IBIBTMS_2F
   SW_OPER_IBICTMS_2F
 https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-2-product-definitions#IBIxTMS_2F 
 https://earth.esa.int/documents/10174/1514862/Swarm_L2_IBI_product_description 

TEC
   SW_OPER_TECATMS_2F
   SW_OPER_TECBTMS_2F
   SW_OPER_TECCTMS_2F
 https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-2-product-definitions#TECxTMS_2F 
 https://earth.esa.int/documents/10174/1514862/Swarm_Level-2_TEC_Product_Description 

FAC
   SW_OPER_FACATMS_2F
   SW_OPER_FACBTMS_2F
   SW_OPER_FACCTMS_2F
   SW_OPER_FAC_TMS_2F
 https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-2-product-definitions#FAC_TMS_2F 
 https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-2-product-definitions#FACxTMS_2F 
 https://earth.esa.int/documents/10174/1514862/Swarm_L2_FAC_single_product_description 
 https://earth.esa.int/documents/10174/1514862/Swarm-L2-FAC-Dual-Product-Description 

EEF
   SW_OPER_EEFATMS_2F
   SW_OPER_EEFBTMS_2F
   SW_OPER_EEFCTMS_2F
 https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-2-product-definitions#EEFxTMS_2F 
 https://earth.esa.int/documents/10174/1514862/Swarm-Level-2-EEF-Product-Description 

IPD
   SW_OPER_IPDAIRR_2F
   SW_OPER_IPDBIRR_2F
   SW_OPER_IPDCIRR_2F
 https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-2-product-definitions#IPDxIPR_2F 

AEJ_LPL
   SW_OPER_AEJALPL_2F
   SW_OPER_AEJBLPL_2F
   SW_OPER_AEJCLPL_2F
https://earth.esa.int/eogateway/activities/swarm-aebs

AEJ_LPL:Quality
   SW_OPER_AEJALPL_2F:Quality
   SW_OPER_AEJBLPL_2F:Quality
   SW_OPER_AEJCLPL_2F:Quality
No reference...

AEJ_LPS
   SW_OPER_AEJALPS_2F
   SW_OPER_AEJBLPS_2F
   SW_OPER_AEJCLPS_2F
https://earth.esa.int/eogateway/activities/swarm-aebs

AEJ_LPS:Quality
   SW_OPER_AEJALPS_2F:Quality
   SW_OPER_AEJBLPS_2F:Quality
   SW_OPER_AEJCLPS_2F:Quality
No reference...

AEJ_PBL
   SW_OPER_AEJAPBL_2F
   SW_OPER_AEJBPBL_2F
   SW_OPER_AEJCPBL_2F
https://earth.esa.int/eogateway/activities/swarm-aebs

AEJ_PBS
   SW_OPER_AEJAPBS_2F
   SW_OPER_AEJBPBS_2F
   SW_OPER_AEJCPBS_2F
https://earth.esa.int/eogateway/activities/swarm-aebs

AEJ_PBS:GroundMagneticDisturbance
   SW_OPER_AEJAPBS_2F:GroundMagneticDisturbance
   SW_OPER_AEJBPBS_2F:GroundMagneticDisturbance
   SW_OPER_AEJCPBS_2F:GroundMagneticDisturbance
No reference...

AOB_FAC
   SW_OPER_AOBAFAC_2F
   SW_OPER_AOBBFAC_2F
   SW_OPER_AOBCFAC_2F
https://earth.esa.int/eogateway/activities/swarm-aebs

AUX_OBSH
   SW_OPER_AUX_OBSH2_
https://doi.org/10.5047/eps.2013.07.011

AUX_OBSM
   SW_OPER_AUX_OBSM2_
https://doi.org/10.5047/eps.2013.07.011

AUX_OBSS
   SW_OPER_AUX_OBSS2_
https://doi.org/10.5047/eps.2013.07.011

VOBS_SW_1M
   SW_OPER_VOBS_1M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_SW_4M
   SW_OPER_VOBS_4M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_CH_1M
   CH_OPER_VOBS_1M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_CR_1M
   CR_OPER_VOBS_1M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_OR_1M
   OR_OPER_VOBS_1M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_CO_1M
   CO_OPER_VOBS_1M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_OR_4M
   OR_OPER_VOBS_4M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_CH_4M
   CH_OPER_VOBS_4M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_CR_4M
   CR_OPER_VOBS_4M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_CO_4M
   CO_OPER_VOBS_4M_2_
https://earth.esa.int/eogateway/activities/gvo

VOBS_SW_1M:SecularVariation
   SW_OPER_VOBS_1M_2_:SecularVariation
No reference...

VOBS_SW_4M:SecularVariation
   SW_OPER_VOBS_4M_2_:SecularVariation
No reference...

VOBS_CH_1M:SecularVariation
   CH_OPER_VOBS_1M_2_:SecularVariation
No reference...

VOBS_CR_1M:SecularVariation
   CR_OPER_VOBS_1M_2_:SecularVariation
No reference...

VOBS_OR_1M:SecularVariation
   OR_OPER_VOBS_1M_2_:SecularVariation
No reference...

VOBS_CO_1M:SecularVariation
   CO_OPER_VOBS_1M_2_:SecularVariation
No reference...

VOBS_OR_4M:SecularVariation
   OR_OPER_VOBS_4M_2_:SecularVariation
No reference...

VOBS_CH_4M:SecularVariation
   CH_OPER_VOBS_4M_2_:SecularVariation
No reference...

VOBS_CR_4M:SecularVariation
   CR_OPER_VOBS_4M_2_:SecularVariation
No reference...

VOBS_CO_4M:SecularVariation
   CO_OPER_VOBS_4M_2_:SecularVariation
No reference...

MIT_LP
   SW_OPER_MITA_LP_2F
   SW_OPER_MITB_LP_2F
   SW_OPER_MITC_LP_2F
https://earth.esa.int/eogateway/activities/plasmapause-related-boundaries-in-the-topside-ionosphere-as-derived-from-swarm-measurements

MIT_LP:ID
   SW_OPER_MITA_LP_2F:ID
   SW_OPER_MITB_LP_2F:ID
   SW_OPER_MITC_LP_2F:ID
No reference...

MIT_TEC
   SW_OPER_MITATEC_2F
   SW_OPER_MITBTEC_2F
   SW_OPER_MITCTEC_2F
https://earth.esa.int/eogateway/activities/plasmapause-related-boundaries-in-the-topside-ionosphere-as-derived-from-swarm-measurements

MIT_TEC:ID
   SW_OPER_MITATEC_2F:ID
   SW_OPER_MITBTEC_2F:ID
   SW_OPER_MITCTEC_2F:ID
No reference...

PPI_FAC
   SW_OPER_PPIAFAC_2F
   SW_OPER_PPIBFAC_2F
   SW_OPER_PPICFAC_2F
https://earth.esa.int/eogateway/activities/plasmapause-related-boundaries-in-the-topside-ionosphere-as-derived-from-swarm-measurements

PPI_FAC:ID
   SW_OPER_PPIAFAC_2F:ID
   SW_OPER_PPIBFAC_2F:ID
   SW_OPER_PPICFAC_2F:ID
No reference...

MAG_CS
   CS_OPER_MAG
https://doi.org/10.1186/s40623-020-01171-9

MAG_GRACE
   GRACE_A_MAG
   GRACE_B_MAG
https://doi.org/10.1186/s40623-021-01373-9

MAG_GFO
   GF1_OPER_FGM_ACAL_CORR
   GF2_OPER_FGM_ACAL_CORR
https://doi.org/10.1186/s40623-021-01364-w

MAG_GOCE
   GO_MAG_ACAL_CORR
https://doi.org/10.5880/GFZ.2.3.2022.001

MAG_GOCE_ML
   GO_MAG_ACAL_CORR_ML
https://doi.org/10.5880/GFZ.2.3.2022.002

MOD_SC
   SW_OPER_MODA_SC_1B
   SW_OPER_MODB_SC_1B
   SW_OPER_MODC_SC_1B
   SW_FAST_MODA_SC_1B
   SW_FAST_MODB_SC_1B
   SW_FAST_MODC_SC_1B
No reference...

Example: get the list of available collections without the details:

request.available_collections(details=False)
{'MAG': ['SW_OPER_MAGA_LR_1B',
  'SW_OPER_MAGB_LR_1B',
  'SW_OPER_MAGC_LR_1B',
  'SW_FAST_MAGA_LR_1B',
  'SW_FAST_MAGB_LR_1B',
  'SW_FAST_MAGC_LR_1B'],
 'MAG_HR': ['SW_OPER_MAGA_HR_1B',
  'SW_OPER_MAGB_HR_1B',
  'SW_OPER_MAGC_HR_1B',
  'SW_FAST_MAGA_HR_1B',
  'SW_FAST_MAGB_HR_1B',
  'SW_FAST_MAGC_HR_1B'],
 'EFI': ['SW_OPER_EFIA_LP_1B',
  'SW_OPER_EFIB_LP_1B',
  'SW_OPER_EFIC_LP_1B',
  'SW_FAST_EFIA_LP_1B',
  'SW_FAST_EFIB_LP_1B',
  'SW_FAST_EFIC_LP_1B'],
 'EFI_IDM': ['SW_PREL_EFIAIDM_2_', 'SW_PREL_EFIBIDM_2_', 'SW_PREL_EFICIDM_2_'],
 'EFI_TIE': ['SW_OPER_EFIATIE_2_', 'SW_OPER_EFIBTIE_2_', 'SW_OPER_EFICTIE_2_'],
 'EFI_TCT02': ['SW_EXPT_EFIA_TCT02',
  'SW_EXPT_EFIB_TCT02',
  'SW_EXPT_EFIC_TCT02'],
 'EFI_TCT16': ['SW_EXPT_EFIA_TCT16',
  'SW_EXPT_EFIB_TCT16',
  'SW_EXPT_EFIC_TCT16'],
 'IBI': ['SW_OPER_IBIATMS_2F', 'SW_OPER_IBIBTMS_2F', 'SW_OPER_IBICTMS_2F'],
 'TEC': ['SW_OPER_TECATMS_2F', 'SW_OPER_TECBTMS_2F', 'SW_OPER_TECCTMS_2F'],
 'FAC': ['SW_OPER_FACATMS_2F',
  'SW_OPER_FACBTMS_2F',
  'SW_OPER_FACCTMS_2F',
  'SW_OPER_FAC_TMS_2F'],
 'EEF': ['SW_OPER_EEFATMS_2F', 'SW_OPER_EEFBTMS_2F', 'SW_OPER_EEFCTMS_2F'],
 'IPD': ['SW_OPER_IPDAIRR_2F', 'SW_OPER_IPDBIRR_2F', 'SW_OPER_IPDCIRR_2F'],
 'AEJ_LPL': ['SW_OPER_AEJALPL_2F', 'SW_OPER_AEJBLPL_2F', 'SW_OPER_AEJCLPL_2F'],
 'AEJ_LPL:Quality': ['SW_OPER_AEJALPL_2F:Quality',
  'SW_OPER_AEJBLPL_2F:Quality',
  'SW_OPER_AEJCLPL_2F:Quality'],
 'AEJ_LPS': ['SW_OPER_AEJALPS_2F', 'SW_OPER_AEJBLPS_2F', 'SW_OPER_AEJCLPS_2F'],
 'AEJ_LPS:Quality': ['SW_OPER_AEJALPS_2F:Quality',
  'SW_OPER_AEJBLPS_2F:Quality',
  'SW_OPER_AEJCLPS_2F:Quality'],
 'AEJ_PBL': ['SW_OPER_AEJAPBL_2F', 'SW_OPER_AEJBPBL_2F', 'SW_OPER_AEJCPBL_2F'],
 'AEJ_PBS': ['SW_OPER_AEJAPBS_2F', 'SW_OPER_AEJBPBS_2F', 'SW_OPER_AEJCPBS_2F'],
 'AEJ_PBS:GroundMagneticDisturbance': ['SW_OPER_AEJAPBS_2F:GroundMagneticDisturbance',
  'SW_OPER_AEJBPBS_2F:GroundMagneticDisturbance',
  'SW_OPER_AEJCPBS_2F:GroundMagneticDisturbance'],
 'AOB_FAC': ['SW_OPER_AOBAFAC_2F', 'SW_OPER_AOBBFAC_2F', 'SW_OPER_AOBCFAC_2F'],
 'AUX_OBSH': ['SW_OPER_AUX_OBSH2_'],
 'AUX_OBSM': ['SW_OPER_AUX_OBSM2_'],
 'AUX_OBSS': ['SW_OPER_AUX_OBSS2_'],
 'VOBS_SW_1M': ['SW_OPER_VOBS_1M_2_'],
 'VOBS_SW_4M': ['SW_OPER_VOBS_4M_2_'],
 'VOBS_CH_1M': ['CH_OPER_VOBS_1M_2_'],
 'VOBS_CR_1M': ['CR_OPER_VOBS_1M_2_'],
 'VOBS_OR_1M': ['OR_OPER_VOBS_1M_2_'],
 'VOBS_CO_1M': ['CO_OPER_VOBS_1M_2_'],
 'VOBS_OR_4M': ['OR_OPER_VOBS_4M_2_'],
 'VOBS_CH_4M': ['CH_OPER_VOBS_4M_2_'],
 'VOBS_CR_4M': ['CR_OPER_VOBS_4M_2_'],
 'VOBS_CO_4M': ['CO_OPER_VOBS_4M_2_'],
 'VOBS_SW_1M:SecularVariation': ['SW_OPER_VOBS_1M_2_:SecularVariation'],
 'VOBS_SW_4M:SecularVariation': ['SW_OPER_VOBS_4M_2_:SecularVariation'],
 'VOBS_CH_1M:SecularVariation': ['CH_OPER_VOBS_1M_2_:SecularVariation'],
 'VOBS_CR_1M:SecularVariation': ['CR_OPER_VOBS_1M_2_:SecularVariation'],
 'VOBS_OR_1M:SecularVariation': ['OR_OPER_VOBS_1M_2_:SecularVariation'],
 'VOBS_CO_1M:SecularVariation': ['CO_OPER_VOBS_1M_2_:SecularVariation'],
 'VOBS_OR_4M:SecularVariation': ['OR_OPER_VOBS_4M_2_:SecularVariation'],
 'VOBS_CH_4M:SecularVariation': ['CH_OPER_VOBS_4M_2_:SecularVariation'],
 'VOBS_CR_4M:SecularVariation': ['CR_OPER_VOBS_4M_2_:SecularVariation'],
 'VOBS_CO_4M:SecularVariation': ['CO_OPER_VOBS_4M_2_:SecularVariation'],
 'MIT_LP': ['SW_OPER_MITA_LP_2F', 'SW_OPER_MITB_LP_2F', 'SW_OPER_MITC_LP_2F'],
 'MIT_LP:ID': ['SW_OPER_MITA_LP_2F:ID',
  'SW_OPER_MITB_LP_2F:ID',
  'SW_OPER_MITC_LP_2F:ID'],
 'MIT_TEC': ['SW_OPER_MITATEC_2F', 'SW_OPER_MITBTEC_2F', 'SW_OPER_MITCTEC_2F'],
 'MIT_TEC:ID': ['SW_OPER_MITATEC_2F:ID',
  'SW_OPER_MITBTEC_2F:ID',
  'SW_OPER_MITCTEC_2F:ID'],
 'PPI_FAC': ['SW_OPER_PPIAFAC_2F', 'SW_OPER_PPIBFAC_2F', 'SW_OPER_PPICFAC_2F'],
 'PPI_FAC:ID': ['SW_OPER_PPIAFAC_2F:ID',
  'SW_OPER_PPIBFAC_2F:ID',
  'SW_OPER_PPICFAC_2F:ID'],
 'MAG_CS': ['CS_OPER_MAG'],
 'MAG_GRACE': ['GRACE_A_MAG', 'GRACE_B_MAG'],
 'MAG_GFO': ['GF1_OPER_FGM_ACAL_CORR', 'GF2_OPER_FGM_ACAL_CORR'],
 'MAG_GOCE': ['GO_MAG_ACAL_CORR'],
 'MAG_GOCE_ML': ['GO_MAG_ACAL_CORR_ML'],
 'MOD_SC': ['SW_OPER_MODA_SC_1B',
  'SW_OPER_MODB_SC_1B',
  'SW_OPER_MODC_SC_1B',
  'SW_FAST_MODA_SC_1B',
  'SW_FAST_MODB_SC_1B',
  'SW_FAST_MODC_SC_1B']}

TOP

Get the available measurements#

It is possible to get the available measurements using the SwarmRequest.available_measurements() method:

SwarmRequest.available_measurements(collection=None)

Parameters:

  • collection (str, optional). If indicated, returns the available measurements for this collection as a list. It can be set to: MAG, EFI, IBI, TEC, FAC, EEF, IPD or one of the collections returned by the available_collections method. If not indicated, it returns the available measurements for all the collections as a dict.

Example: get the list of measurements for the MAG collections:

# Import SwarmRequest object (this step can be skipped if SwarmRequest has been already imported)
from viresclient import SwarmRequest

# Create the request object
request = SwarmRequest()

# Get the available measurements
request.available_measurements('MAG')
['F',
 'dF_Sun',
 'dF_AOCS',
 'dF_other',
 'F_error',
 'B_VFM',
 'B_NEC',
 'dB_Sun',
 'dB_AOCS',
 'dB_other',
 'B_error',
 'q_NEC_CRF',
 'Att_error',
 'Flags_F',
 'Flags_B',
 'Flags_q',
 'Flags_Platform',
 'ASM_Freq_Dev']

Setting collection=SW_OPER_MAGA_LR_1B we obtain the same result:

request.available_measurements('SW_OPER_MAGA_LR_1B')
['F',
 'dF_Sun',
 'dF_AOCS',
 'dF_other',
 'F_error',
 'B_VFM',
 'B_NEC',
 'dB_Sun',
 'dB_AOCS',
 'dB_other',
 'B_error',
 'q_NEC_CRF',
 'Att_error',
 'Flags_F',
 'Flags_B',
 'Flags_q',
 'Flags_Platform',
 'ASM_Freq_Dev']

Example: get all the available measurements:

request.available_measurements()
{'MAG': ['F',
  'dF_Sun',
  'dF_AOCS',
  'dF_other',
  'F_error',
  'B_VFM',
  'B_NEC',
  'dB_Sun',
  'dB_AOCS',
  'dB_other',
  'B_error',
  'q_NEC_CRF',
  'Att_error',
  'Flags_F',
  'Flags_B',
  'Flags_q',
  'Flags_Platform',
  'ASM_Freq_Dev'],
 'MAG_HR': ['F',
  'B_VFM',
  'B_NEC',
  'dB_Sun',
  'dB_AOCS',
  'dB_other',
  'B_error',
  'q_NEC_CRF',
  'Att_error',
  'Flags_B',
  'Flags_q',
  'Flags_Platform'],
 'EFI': ['U_orbit',
  'Ne',
  'Ne_error',
  'Te',
  'Te_error',
  'Vs',
  'Vs_error',
  'Flags_LP',
  'Flags_Ne',
  'Flags_Te',
  'Flags_Vs'],
 'EFI_IDM': ['Latitude_GD',
  'Longitude_GD',
  'Height_GD',
  'Radius_GC',
  'Latitude_QD',
  'MLT_QD',
  'V_sat_nec',
  'M_i_eff',
  'M_i_eff_err',
  'M_i_eff_Flags',
  'M_i_eff_tbt_model',
  'V_i',
  'V_i_err',
  'V_i_Flags',
  'V_i_raw',
  'N_i',
  'N_i_err',
  'N_i_Flags',
  'A_fp',
  'R_p',
  'T_e',
  'Phi_sc'],
 'EFI_TIE': ['Latitude_GD',
  'Longitude_GD',
  'Height_GD',
  'Radius_GC',
  'Latitude_QD',
  'MLT_QD',
  'Tn_msis',
  'Te_adj_LP',
  'Ti_meas_drift',
  'Ti_model_drift',
  'Flag_ti_meas',
  'Flag_ti_model'],
 'EFI_TCT02': ['VsatC',
  'VsatE',
  'VsatN',
  'Bx',
  'By',
  'Bz',
  'Ehx',
  'Ehy',
  'Ehz',
  'Evx',
  'Evy',
  'Evz',
  'Vicrx',
  'Vicry',
  'Vicrz',
  'Vixv',
  'Vixh',
  'Viy',
  'Viz',
  'Vixv_error',
  'Vixh_error',
  'Viy_error',
  'Viz_error',
  'Latitude_QD',
  'MLT_QD',
  'Calibration_flags',
  'Quality_flags'],
 'EFI_TCT16': ['VsatC',
  'VsatE',
  'VsatN',
  'Bx',
  'By',
  'Bz',
  'Ehx',
  'Ehy',
  'Ehz',
  'Evx',
  'Evy',
  'Evz',
  'Vicrx',
  'Vicry',
  'Vicrz',
  'Vixv',
  'Vixh',
  'Viy',
  'Viz',
  'Vixv_error',
  'Vixh_error',
  'Viy_error',
  'Viz_error',
  'Latitude_QD',
  'MLT_QD',
  'Calibration_flags',
  'Quality_flags'],
 'IBI': ['Bubble_Index',
  'Bubble_Probability',
  'Flags_Bubble',
  'Flags_F',
  'Flags_B',
  'Flags_q'],
 'TEC': ['GPS_Position',
  'LEO_Position',
  'PRN',
  'L1',
  'L2',
  'P1',
  'P2',
  'S1',
  'S2',
  'Elevation_Angle',
  'Absolute_VTEC',
  'Absolute_STEC',
  'Relative_STEC',
  'Relative_STEC_RMS',
  'DCB',
  'DCB_Error'],
 'FAC': ['IRC',
  'IRC_Error',
  'FAC',
  'FAC_Error',
  'Flags',
  'Flags_F',
  'Flags_B',
  'Flags_q'],
 'EEF': ['EEF', 'EEJ', 'RelErr', 'Flags'],
 'IPD': ['Ne',
  'Te',
  'Background_Ne',
  'Foreground_Ne',
  'PCP_flag',
  'Grad_Ne_at_100km',
  'Grad_Ne_at_50km',
  'Grad_Ne_at_20km',
  'Grad_Ne_at_PCP_edge',
  'ROD',
  'RODI10s',
  'RODI20s',
  'delta_Ne10s',
  'delta_Ne20s',
  'delta_Ne40s',
  'Num_GPS_satellites',
  'mVTEC',
  'mROT',
  'mROTI10s',
  'mROTI20s',
  'IBI_flag',
  'Ionosphere_region_flag',
  'IPIR_index',
  'Ne_quality_flag',
  'TEC_STD'],
 'AEJ_LPL': ['Latitude_QD', 'Longitude_QD', 'MLT_QD', 'J_NE', 'J_QD'],
 'AEJ_LPL:Quality': ['RMS_misfit', 'Confidence'],
 'AEJ_LPS': ['Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'J_CF_NE',
  'J_DF_NE',
  'J_CF_SemiQD',
  'J_DF_SemiQD',
  'J_R'],
 'AEJ_LPS:Quality': ['RMS_misfit', 'Confidence'],
 'AEJ_PBL': ['Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'J_QD',
  'Flags',
  'PointType'],
 'AEJ_PBS': ['Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'J_DF_SemiQD',
  'Flags',
  'PointType'],
 'AEJ_PBS:GroundMagneticDisturbance': ['B_NE'],
 'AOB_FAC': ['Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'Boundary_Flag',
  'Quality',
  'Pair_Indicator'],
 'AUX_OBSH': ['B_NEC', 'F', 'IAGA_code', 'Quality', 'ObsIndex'],
 'AUX_OBSM': ['B_NEC', 'F', 'IAGA_code', 'Quality'],
 'AUX_OBSS': ['B_NEC', 'F', 'IAGA_code', 'Quality'],
 'VOBS_SW_1M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_CH_1M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_CR_1M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_OR_1M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_CO_1M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_OR_4M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_SW_4M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_CH_4M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_CR_4M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_CO_4M': ['SiteCode', 'B_CF', 'B_OB', 'sigma_CF', 'sigma_OB'],
 'VOBS_SW_1M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'VOBS_CH_1M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'VOBS_CR_1M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'VOBS_OR_1M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'VOBS_CO_1M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'VOBS_OR_4M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'VOBS_SW_4M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'VOBS_CH_4M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'VOBS_CR_4M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'VOBS_CO_4M:SecularVariation': ['SiteCode', 'B_SV', 'sigma_SV'],
 'MIT_LP': ['Counter',
  'Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'L_value',
  'SZA',
  'Ne',
  'Te',
  'Depth',
  'DR',
  'Width',
  'dL',
  'PW_Gradient',
  'EW_Gradient',
  'Quality'],
 'MIT_LP:ID': ['Counter',
  'Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'L_value',
  'SZA',
  'Ne',
  'Te',
  'Position_Quality',
  'PointType'],
 'MIT_TEC': ['Counter',
  'Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'L_value',
  'SZA',
  'TEC',
  'Depth',
  'DR',
  'Width',
  'dL',
  'PW_Gradient',
  'EW_Gradient',
  'Quality'],
 'MIT_TEC:ID': ['Counter',
  'Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'L_value',
  'SZA',
  'TEC',
  'Position_Quality',
  'PointType'],
 'PPI_FAC': ['Counter',
  'Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'L_value',
  'SZA',
  'Sigma',
  'PPI',
  'dL',
  'Quality'],
 'PPI_FAC:ID': ['Counter',
  'Latitude_QD',
  'Longitude_QD',
  'MLT_QD',
  'L_value',
  'SZA',
  'Position_Quality',
  'PointType'],
 'MAG_CS': ['F',
  'B_NEC',
  'B_mod_NEC',
  'B_NEC1',
  'B_NEC2',
  'B_NEC3',
  'B_FGM1',
  'B_FGM2',
  'B_FGM3',
  'q_NEC_CRF',
  'q_error'],
 'MAG_GRACE': ['F', 'B_NEC', 'B_NEC_raw', 'B_FGM', 'q_NEC_CRF', 'q_error'],
 'MAG_GFO': ['F',
  'B_NEC',
  'B_FGM',
  'dB_MTQ_FGM',
  'dB_XI_FGM',
  'dB_NY_FGM',
  'dB_BT_FGM',
  'dB_ST_FGM',
  'dB_SA_FGM',
  'dB_BAT_FGM',
  'q_NEC_FGM',
  'B_FLAG'],
 'MAG_GOCE': ['F',
  'B_MAG',
  'B_NEC',
  'dB_MTQ_SC',
  'dB_XI_SC',
  'dB_NY_SC',
  'dB_BT_SC',
  'dB_ST_SC',
  'dB_SA_SC',
  'dB_BAT_SC',
  'dB_HK_SC',
  'dB_BLOCK_CORR',
  'q_SC_NEC',
  'q_MAG_SC',
  'B_FLAG'],
 'MAG_GOCE_ML': ['F',
  'B_MAG',
  'B_NEC',
  'q_FGM_NEC',
  'B_FLAG',
  'KP_DST_FLAG',
  'NaN_FLAG',
  'Latitude_QD',
  'Longitude_QD'],
 'MOD_SC': []}

TOP

Get the available auxiliaries#

It is possible to get the available auxiliaries using the SwarmRequest.available_auxiliaries() method:

SwarmRequest.available_auxiliaries()

This method does not accept input parameters and provides the available auxiliaries as a list.

Example: get the list of the available auxiliaries:

# Import SwarmRequest object (this step can be skipped if SwarmRequest has been already imported)
from viresclient import SwarmRequest

# Create the request object
request = SwarmRequest()

# Get the list of available auxiliaries
request.available_auxiliaries()
['Timestamp',
 'Latitude',
 'Longitude',
 'Radius',
 'Spacecraft',
 'OrbitDirection',
 'QDOrbitDirection',
 'SyncStatus',
 'Kp10',
 'Kp',
 'Dst',
 'F107',
 'IMF_BY_GSM',
 'IMF_BZ_GSM',
 'IMF_V',
 'F10_INDEX',
 'OrbitSource',
 'OrbitNumber',
 'AscendingNodeTime',
 'AscendingNodeLongitude',
 'QDLat',
 'QDLon',
 'QDBasis',
 'MLT',
 'SunDeclination',
 'SunHourAngle',
 'SunRightAscension',
 'SunAzimuthAngle',
 'SunZenithAngle',
 'SunLongitude',
 'SunVector',
 'DipoleAxisVector',
 'NGPLatitude',
 'NGPLongitude',
 'DipoleTiltAngle',
 'dDst']

TOP

Get the available magnetic models#

The available magnetic models can be obtained using the SwarmRequest.available_models() method:

SwarmRequest.available_models(param=None, details=True, nice_output=True)

Parameters:

  • param (str, optional): it can be set to one of F, C, D, MCO, MLI, MMA, MIO to filter all the available magnetic models.

  • details (bool, optional): if it is set to True (default), it gets the models and their details. If False, it returns only the models as a list.

  • nice_output (bool, optional): if it is set to True (default), it prints the models and their details. If False, it returns the models as a dictionary (if details=True) or a s a list (if details=False).

Example: get the list of all the available models and their details:

# Import SwarmRequest object (this step can be skipped if SwarmRequest has been already imported)
from viresclient import SwarmRequest

# Create the request object
request = SwarmRequest()

# Get available models
request.available_models()
AMPS = AMPS()
  START: 1900-01-01T00:00:00Z
  END:   2025-01-01T00:00:00Z
DESCRIPTION:
AMPS - associated magnetic field, https://github.com/klaundal/pyAMPS
SOURCES:
  SW_OPER_MIO_SHA_2E_00000000T000000_99999999T999999_0104

CHAOS = 'CHAOS-Core'(max_degree=20,min_degree=1) + 'CHAOS-Static'(max_degree=185,min_degree=21) + 'CHAOS-MMA-Primary'(max_degree=2,min_degree=1) + 'CHAOS-MMA-Secondary'(max_degree=2,min_degree=1)
  START: 2000-01-01T00:00:00Z
  END:   2024-01-24T19:30:00Z
DESCRIPTION:
Alias for 'CHAOS-Core' + 'CHAOS-Static' + 'CHAOS-MMA-Primary' + 'CHAOS-MMA-Secondary'
SOURCES:
  CHAOS-7_static.shc
  SW_OPER_MCO_SHA_2X_19970101T000000_20240207T235959_0716
  SW_OPER_MMA_CHAOS__20000101T000000_20001231T233000_0704
  SW_OPER_MMA_CHAOS__20010101T000000_20011231T233000_0704
  SW_OPER_MMA_CHAOS__20020101T000000_20021231T233000_0704
  SW_OPER_MMA_CHAOS__20030101T000000_20031231T233000_0704
  SW_OPER_MMA_CHAOS__20040101T000000_20041231T233000_0704
  SW_OPER_MMA_CHAOS__20050101T000000_20051231T233000_0704
  SW_OPER_MMA_CHAOS__20060101T000000_20061231T233000_0704
  SW_OPER_MMA_CHAOS__20070101T000000_20071231T233000_0704
  SW_OPER_MMA_CHAOS__20080101T000000_20081231T233000_0704
  SW_OPER_MMA_CHAOS__20090101T000000_20091231T233000_0704
  SW_OPER_MMA_CHAOS__20100101T000000_20101231T233000_0704
  SW_OPER_MMA_CHAOS__20110101T000000_20111231T233000_0704
  SW_OPER_MMA_CHAOS__20120101T000000_20121231T233000_0704
  SW_OPER_MMA_CHAOS__20130101T000000_20131231T233000_0704
  SW_OPER_MMA_CHAOS__20140101T000000_20141231T233000_0704
  SW_OPER_MMA_CHAOS__20150101T000000_20151231T233000_0704
  SW_OPER_MMA_CHAOS__20160101T000000_20161231T233000_0704
  SW_OPER_MMA_CHAOS__20170101T000000_20171231T233000_0704
  SW_OPER_MMA_CHAOS__20180101T000000_20181231T233000_0704
  SW_OPER_MMA_CHAOS__20190101T000000_20191231T233000_0704
  SW_OPER_MMA_CHAOS__20200101T000000_20201231T233000_0708
  SW_OPER_MMA_CHAOS__20210101T000000_20211231T233000_0712
  SW_OPER_MMA_CHAOS__20220101T000000_20221231T233000_0716
  SW_OPER_MMA_CHAOS__20230101T000000_20240124T193000_0716

CHAOS-Core = 'CHAOS-Core'(max_degree=20,min_degree=1)
  START: 1997-02-07T05:23:17.067838Z
  END:   2024-02-07T13:50:52.834559Z
DESCRIPTION:
CHAOS-7 Core field (SH degrees 1-20)
 http://www.spacecenter.dk/files/magnetic-models/CHAOS-7/ 
SOURCES:
  SW_OPER_MCO_SHA_2X_19970101T000000_20240207T235959_0716

CHAOS-MMA = 'CHAOS-MMA-Primary'(max_degree=2,min_degree=1) + 'CHAOS-MMA-Secondary'(max_degree=2,min_degree=1)
  START: 2000-01-01T00:00:00Z
  END:   2024-01-24T19:30:00Z
DESCRIPTION:
Alias for 'CHAOS-MMA-Primary' + 'CHAOS-MMA-Secondary'
SOURCES:
  SW_OPER_MMA_CHAOS__20000101T000000_20001231T233000_0704
  SW_OPER_MMA_CHAOS__20010101T000000_20011231T233000_0704
  SW_OPER_MMA_CHAOS__20020101T000000_20021231T233000_0704
  SW_OPER_MMA_CHAOS__20030101T000000_20031231T233000_0704
  SW_OPER_MMA_CHAOS__20040101T000000_20041231T233000_0704
  SW_OPER_MMA_CHAOS__20050101T000000_20051231T233000_0704
  SW_OPER_MMA_CHAOS__20060101T000000_20061231T233000_0704
  SW_OPER_MMA_CHAOS__20070101T000000_20071231T233000_0704
  SW_OPER_MMA_CHAOS__20080101T000000_20081231T233000_0704
  SW_OPER_MMA_CHAOS__20090101T000000_20091231T233000_0704
  SW_OPER_MMA_CHAOS__20100101T000000_20101231T233000_0704
  SW_OPER_MMA_CHAOS__20110101T000000_20111231T233000_0704
  SW_OPER_MMA_CHAOS__20120101T000000_20121231T233000_0704
  SW_OPER_MMA_CHAOS__20130101T000000_20131231T233000_0704
  SW_OPER_MMA_CHAOS__20140101T000000_20141231T233000_0704
  SW_OPER_MMA_CHAOS__20150101T000000_20151231T233000_0704
  SW_OPER_MMA_CHAOS__20160101T000000_20161231T233000_0704
  SW_OPER_MMA_CHAOS__20170101T000000_20171231T233000_0704
  SW_OPER_MMA_CHAOS__20180101T000000_20181231T233000_0704
  SW_OPER_MMA_CHAOS__20190101T000000_20191231T233000_0704
  SW_OPER_MMA_CHAOS__20200101T000000_20201231T233000_0708
  SW_OPER_MMA_CHAOS__20210101T000000_20211231T233000_0712
  SW_OPER_MMA_CHAOS__20220101T000000_20221231T233000_0716
  SW_OPER_MMA_CHAOS__20230101T000000_20240124T193000_0716

CHAOS-MMA-Primary = 'CHAOS-MMA-Primary'(max_degree=2,min_degree=1)
  START: 2000-01-01T00:00:00Z
  END:   2024-01-24T19:30:00Z
DESCRIPTION:
CHAOS-7 Primary (external) magnetospheric field
 hhttp://www.spacecenter.dk/files/magnetic-models/CHAOS-7/ 
SOURCES:
  SW_OPER_MMA_CHAOS__20000101T000000_20001231T233000_0704
  SW_OPER_MMA_CHAOS__20010101T000000_20011231T233000_0704
  SW_OPER_MMA_CHAOS__20020101T000000_20021231T233000_0704
  SW_OPER_MMA_CHAOS__20030101T000000_20031231T233000_0704
  SW_OPER_MMA_CHAOS__20040101T000000_20041231T233000_0704
  SW_OPER_MMA_CHAOS__20050101T000000_20051231T233000_0704
  SW_OPER_MMA_CHAOS__20060101T000000_20061231T233000_0704
  SW_OPER_MMA_CHAOS__20070101T000000_20071231T233000_0704
  SW_OPER_MMA_CHAOS__20080101T000000_20081231T233000_0704
  SW_OPER_MMA_CHAOS__20090101T000000_20091231T233000_0704
  SW_OPER_MMA_CHAOS__20100101T000000_20101231T233000_0704
  SW_OPER_MMA_CHAOS__20110101T000000_20111231T233000_0704
  SW_OPER_MMA_CHAOS__20120101T000000_20121231T233000_0704
  SW_OPER_MMA_CHAOS__20130101T000000_20131231T233000_0704
  SW_OPER_MMA_CHAOS__20140101T000000_20141231T233000_0704
  SW_OPER_MMA_CHAOS__20150101T000000_20151231T233000_0704
  SW_OPER_MMA_CHAOS__20160101T000000_20161231T233000_0704
  SW_OPER_MMA_CHAOS__20170101T000000_20171231T233000_0704
  SW_OPER_MMA_CHAOS__20180101T000000_20181231T233000_0704
  SW_OPER_MMA_CHAOS__20190101T000000_20191231T233000_0704
  SW_OPER_MMA_CHAOS__20200101T000000_20201231T233000_0708
  SW_OPER_MMA_CHAOS__20210101T000000_20211231T233000_0712
  SW_OPER_MMA_CHAOS__20220101T000000_20221231T233000_0716
  SW_OPER_MMA_CHAOS__20230101T000000_20240124T193000_0716

CHAOS-MMA-Secondary = 'CHAOS-MMA-Secondary'(max_degree=2,min_degree=1)
  START: 2000-01-01T00:00:00Z
  END:   2024-01-24T19:30:00Z
DESCRIPTION:
CHAOS-7 Secondary (internal) magnetospheric field
 http://www.spacecenter.dk/files/magnetic-models/CHAOS-7/ 
SOURCES:
  SW_OPER_MMA_CHAOS__20000101T000000_20001231T233000_0704
  SW_OPER_MMA_CHAOS__20010101T000000_20011231T233000_0704
  SW_OPER_MMA_CHAOS__20020101T000000_20021231T233000_0704
  SW_OPER_MMA_CHAOS__20030101T000000_20031231T233000_0704
  SW_OPER_MMA_CHAOS__20040101T000000_20041231T233000_0704
  SW_OPER_MMA_CHAOS__20050101T000000_20051231T233000_0704
  SW_OPER_MMA_CHAOS__20060101T000000_20061231T233000_0704
  SW_OPER_MMA_CHAOS__20070101T000000_20071231T233000_0704
  SW_OPER_MMA_CHAOS__20080101T000000_20081231T233000_0704
  SW_OPER_MMA_CHAOS__20090101T000000_20091231T233000_0704
  SW_OPER_MMA_CHAOS__20100101T000000_20101231T233000_0704
  SW_OPER_MMA_CHAOS__20110101T000000_20111231T233000_0704
  SW_OPER_MMA_CHAOS__20120101T000000_20121231T233000_0704
  SW_OPER_MMA_CHAOS__20130101T000000_20131231T233000_0704
  SW_OPER_MMA_CHAOS__20140101T000000_20141231T233000_0704
  SW_OPER_MMA_CHAOS__20150101T000000_20151231T233000_0704
  SW_OPER_MMA_CHAOS__20160101T000000_20161231T233000_0704
  SW_OPER_MMA_CHAOS__20170101T000000_20171231T233000_0704
  SW_OPER_MMA_CHAOS__20180101T000000_20181231T233000_0704
  SW_OPER_MMA_CHAOS__20190101T000000_20191231T233000_0704
  SW_OPER_MMA_CHAOS__20200101T000000_20201231T233000_0708
  SW_OPER_MMA_CHAOS__20210101T000000_20211231T233000_0712
  SW_OPER_MMA_CHAOS__20220101T000000_20221231T233000_0716
  SW_OPER_MMA_CHAOS__20230101T000000_20240124T193000_0716

CHAOS-Static = 'CHAOS-Static'(max_degree=185,min_degree=21)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
CHAOS-7 crust field (SH degrees 21-185)
 http://www.spacecenter.dk/files/magnetic-models/CHAOS-7/ 
SOURCES:
  CHAOS-7_static.shc

IGRF = IGRF(max_degree=13,min_degree=1)
  START: 1900-01-01T00:00:00Z
  END:   2025-01-01T00:00:00Z
DESCRIPTION:
 International Geomagnetic Reference Field: the thirteenth generation, (https://doi.org/10.1186/s40623-020-01288-x) 
 https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html 
SOURCES:
  SW_OPER_AUX_IGR_2__19000101T000000_20241231T235959_0103

LCS-1 = 'LCS-1'(max_degree=185,min_degree=1)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
The LCS-1 high-resolution lithospheric field model, derived from CHAMP and Swarm satellite observations
 http://www.spacecenter.dk/files/magnetic-models/LCS-1/
SOURCES:
  LCS-1.shc

MCO_SHA_2C = MCO_SHA_2C(max_degree=18,min_degree=1)
  START: 2013-11-24T18:34:03.360004Z
  END:   2023-01-01T00:00:00Z
DESCRIPTION:
[Comprehensive Inversion]: Core field of CIY4
 A comprehensive model of Earth’s magnetic field determined from 4 years of Swarm satellite observations, https://doi.org/10.1186/s40623-018-0896-3 
Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MCO/SW_OPER_MCO_VAL_2C_20131201T000000_20180101T000000_0401.ZIP 
SOURCES:
  SW_OPER_MCO_SHA_2C_20131125T000000_20230101T000000_0901

MCO_SHA_2D = MCO_SHA_2D(max_degree=20,min_degree=1)
  START: 2013-11-25T12:00:00.000003Z
  END:   2018-01-01T00:00:00Z
DESCRIPTION:
[Dedicated Chain]: Core field
An algorithm for deriving core magnetic field models from the Swarm data set, https://doi.org/10.5047/eps.2013.07.005 
Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MCO/SW_OPER_MCO_VAL_2D_20131126T000000_20180101T000000_0401.ZIP 
SOURCES:
  SW_OPER_MCO_SHA_2D_20131126T000000_20180101T000000_0401

MCO_SHA_2X = 'CHAOS-Core'(max_degree=20,min_degree=1)
  START: 1997-02-07T05:23:17.067838Z
  END:   2024-02-07T13:50:52.834559Z
DESCRIPTION:
Alias for 'CHAOS-Core'
SOURCES:
  SW_OPER_MCO_SHA_2X_19970101T000000_20240207T235959_0716

MF7 = MF7(max_degree=133,min_degree=16)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
MF7 crustal field model, derived from CHAMP satellite observations
 http://geomag.org/models/MF7.html
SOURCES:
  MF7.shc

MIO_SHA_2C = 'MIO_SHA_2C-Primary'(max_degree=60,min_degree=1) + 'MIO_SHA_2C-Secondary'(max_degree=60,min_degree=1)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
Alias for 'MIO_SHA_2C-Primary' + 'MIO_SHA_2C-Secondary'
SOURCES:
  SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901

MIO_SHA_2C-Primary = 'MIO_SHA_2C-Primary'(max_degree=60,min_degree=1)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
[Comprehensive Inversion]: Primary (external) ionospheric field of CIY4
Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MIO/SW_OPER_MIO_VAL_2C_00000000T000000_99999999T999999_0401.ZIP 
SOURCES:
  SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901

MIO_SHA_2C-Secondary = 'MIO_SHA_2C-Secondary'(max_degree=60,min_degree=1)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
[Comprehensive Inversion]: Secondary (external/induced) ionospheric field of CIY4
SOURCES:
  SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901

MIO_SHA_2D = 'MIO_SHA_2D-Primary'(max_degree=60,min_degree=1) + 'MIO_SHA_2D-Secondary'(max_degree=60,min_degree=1)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
Alias for 'MIO_SHA_2D-Primary' + 'MIO_SHA_2D-Secondary'
SOURCES:
  SW_OPER_MIO_SHA_2D_20131201T000000_20220531T235959_0801

MIO_SHA_2D-Primary = 'MIO_SHA_2D-Primary'(max_degree=60,min_degree=1)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
[Dedicated Chain]: Primary (external) ionospheric field, DIFI
 Swarm SCARF dedicated ionospheric field inversion chain, https://doi.org/10.5047/eps.2013.08.006 
 First results from the Swarm Dedicated Ionospheric Field Inversion chain, https://doi.org/10.1186/s40623-016-0481-6 
 http://geomag.colorado.edu/difi-3 
Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MIO/SW_OPER_MIO_VAL_2D_20131201T000000_20171231T235959_0402.ZIP 
SOURCES:
  SW_OPER_MIO_SHA_2D_20131201T000000_20220531T235959_0801

MIO_SHA_2D-Secondary = 'MIO_SHA_2D-Secondary'(max_degree=60,min_degree=1)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
[Dedicated Chain]: Secondary (external/induced) ionospheric field, DIFI
SOURCES:
  SW_OPER_MIO_SHA_2D_20131201T000000_20220531T235959_0801

MLI_SHA_2C = MLI_SHA_2C(max_degree=120,min_degree=16)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
[Comprehensive Inversion]: Lithospheric field of CIY4
Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MLI/SW_OPER_MLI_VAL_2C_00000000T000000_99999999T999999_0401.ZIP
SOURCES:
  SW_OPER_MLI_SHA_2C_00000000T000000_99999999T999999_0901

MLI_SHA_2D = MLI_SHA_2D(max_degree=133,min_degree=16)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
[Dedicated Chain]: Lithospheric field
 Swarm SCARF Dedicated Lithospheric Field Inversion chain, https://doi.org/10.5047/eps.2013.07.008 
 Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MLI/SW_OPER_MLI_VAL_2D_00000000T000000_99999999T999999_0401.ZIP 
SOURCES:
  SW_OPER_MLI_SHA_2D_00000000T000000_99999999T999999_0501

MLI_SHA_2E = MLI_SHA_2E(max_degree=1319,min_degree=16)
  START: 0001-01-01T00:00:00Z
  END:   4000-01-01T00:00:00Z
DESCRIPTION:
[Extended dedicated chain]: Lithospheric field
 Joint inversion of Swarm, CHAMP, and WDMAM data 
 https://swarm-diss.eo.esa.int/?do=download&file=swarm%2FLevel2longterm%2FMLI%2FSW_OPER_MLI_VAL_2E_00000000T000000_99999999T999999_0502.ZIP 
SOURCES:
  SW_OPER_MLI_SHA_2E_00000000T000000_99999999T999999_0801

MMA_SHA_2C = 'MMA_SHA_2C-Primary'(max_degree=2,min_degree=1) + 'MMA_SHA_2C-Secondary'(max_degree=3,min_degree=1)
  START: 2013-11-25T03:00:00Z
  END:   2018-12-31T21:00:00Z
DESCRIPTION:
Alias for 'MMA_SHA_2C-Primary' + 'MMA_SHA_2C-Secondary'
SOURCES:
  SW_OPER_MMA_SHA_2C_20131125T000000_20181231T235959_0501

MMA_SHA_2C-Primary = 'MMA_SHA_2C-Primary'(max_degree=2,min_degree=1)
  START: 2013-11-25T03:00:00Z
  END:   2018-12-31T21:00:00Z
DESCRIPTION:
[Comprehensive Inversion]: Primary (external) magnetospheric field of CIY4
Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MMA/SW_OPER_MMA_VAL_2C_20131201T000000_20180101T000000_0401.ZIP
SOURCES:
  SW_OPER_MMA_SHA_2C_20131125T000000_20181231T235959_0501

MMA_SHA_2C-Secondary = 'MMA_SHA_2C-Secondary'(max_degree=3,min_degree=1)
  START: 2013-11-25T03:00:00Z
  END:   2018-12-31T21:00:00Z
DESCRIPTION:
[Comprehensive Inversion]: Secondary (internal/induced) magnetospheric field of CIY4
SOURCES:
  SW_OPER_MMA_SHA_2C_20131125T000000_20181231T235959_0501

MMA_SHA_2F = 'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1) + 'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-01-20T21:45:00Z
DESCRIPTION:
Alias for 'MMA_SHA_2F-Primary' + 'MMA_SHA_2F-Secondary'
SOURCES:
  SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108
  SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108
  SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108
  SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108
  SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108
  SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108
  SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108
  SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108
  SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108
  SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108
  SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108
  SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108

MMA_SHA_2F-Primary = 'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-01-20T21:45:00Z
DESCRIPTION:
[Fast-Track Product]: Primary (external) magnetospheric field
 Rapid modelling of the large-scale magnetospheric field from Swarm satellite data, https://doi.org/10.5047/eps.2013.09.003 
SOURCES:
  SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108
  SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108
  SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108
  SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108
  SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108
  SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108
  SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108
  SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108
  SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108
  SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108
  SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108
  SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108

MMA_SHA_2F-Secondary = 'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-01-20T21:45:00Z
DESCRIPTION:
[Fast-Track Product]: Secondary (internal/induced) magnetospheric field
SOURCES:
  SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108
  SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108
  SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108
  SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108
  SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108
  SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108
  SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108
  SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108
  SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108
  SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108
  SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108
  SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108

SwarmCI = MCO_SHA_2C(max_degree=18,min_degree=1) + MLI_SHA_2C(max_degree=120,min_degree=16) + 'MMA_SHA_2C-Primary'(max_degree=2,min_degree=1) + 'MMA_SHA_2C-Secondary'(max_degree=3,min_degree=1) + 'MIO_SHA_2C-Primary'(max_degree=60,min_degree=1) + 'MIO_SHA_2C-Secondary'(max_degree=60,min_degree=1)
  START: 2013-11-25T03:00:00Z
  END:   2018-12-31T21:00:00Z
DESCRIPTION:
Alias for 'MCO_SHA_2C' + 'MLI_SHA_2C' + 'MIO_SHA_2C-Primary' + 'MIO_SHA_2C-Secondary' + 'MMA_SHA_2C-Primary' + 'MMA_SHA_2C-Secondary'
SOURCES:
  SW_OPER_MCO_SHA_2C_20131125T000000_20230101T000000_0901
  SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901
  SW_OPER_MLI_SHA_2C_00000000T000000_99999999T999999_0901
  SW_OPER_MMA_SHA_2C_20131125T000000_20181231T235959_0501

Example: print the list of the available F (Fast-Track) models and their details:

request.available_models('F')
MMA_SHA_2F = 'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1) + 'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-01-20T21:45:00Z
DESCRIPTION:
Alias for 'MMA_SHA_2F-Primary' + 'MMA_SHA_2F-Secondary'
SOURCES:
  SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108
  SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108
  SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108
  SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108
  SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108
  SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108
  SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108
  SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108
  SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108
  SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108
  SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108
  SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108

MMA_SHA_2F-Primary = 'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-01-20T21:45:00Z
DESCRIPTION:
[Fast-Track Product]: Primary (external) magnetospheric field
 Rapid modelling of the large-scale magnetospheric field from Swarm satellite data, https://doi.org/10.5047/eps.2013.09.003 
SOURCES:
  SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108
  SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108
  SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108
  SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108
  SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108
  SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108
  SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108
  SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108
  SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108
  SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108
  SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108
  SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108

MMA_SHA_2F-Secondary = 'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-01-20T21:45:00Z
DESCRIPTION:
[Fast-Track Product]: Secondary (internal/induced) magnetospheric field
SOURCES:
  SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108
  SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108
  SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108
  SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108
  SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108
  SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108
  SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108
  SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108
  SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108
  SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108
  SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108
  SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108

Example: get the If the list of models of type F as a dictionary:

request.available_models(param='F', nice_output=False)
{'MMA_SHA_2F-Primary': {'description': ('[Fast-Track Product]: Primary (external) magnetospheric field',
   ' Rapid modelling of the large-scale magnetospheric field from Swarm satellite data, https://doi.org/10.5047/eps.2013.09.003 '),
  'details': {'expression': "'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1)",
   'validity': {'start': '2013-11-25T11:15:00Z',
    'end': '2024-01-20T21:45:00Z'},
   'sources': ['SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108']}},
 'MMA_SHA_2F-Secondary': {'description': ('[Fast-Track Product]: Secondary (internal/induced) magnetospheric field',),
  'details': {'expression': "'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)",
   'validity': {'start': '2013-11-25T11:15:00Z',
    'end': '2024-01-20T21:45:00Z'},
   'sources': ['SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108']}},
 'MMA_SHA_2F': {'description': ("Alias for 'MMA_SHA_2F-Primary' + 'MMA_SHA_2F-Secondary'",),
  'details': {'expression': "'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1) + 'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)",
   'validity': {'start': '2013-11-25T11:15:00Z',
    'end': '2024-01-20T21:45:00Z'},
   'sources': ['SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108',
    'SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108',
    'SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108']}}}

Example: get the list of all the available models without their details:

request.available_models(details=False)
['IGRF',
 'LCS-1',
 'MF7',
 'CHAOS-Core',
 'CHAOS-Static',
 'CHAOS-MMA-Primary',
 'CHAOS-MMA-Secondary',
 'MCO_SHA_2C',
 'MCO_SHA_2D',
 'MLI_SHA_2C',
 'MLI_SHA_2D',
 'MLI_SHA_2E',
 'MMA_SHA_2C-Primary',
 'MMA_SHA_2C-Secondary',
 'MMA_SHA_2F-Primary',
 'MMA_SHA_2F-Secondary',
 'MIO_SHA_2C-Primary',
 'MIO_SHA_2C-Secondary',
 'MIO_SHA_2D-Primary',
 'MIO_SHA_2D-Secondary',
 'AMPS',
 'MCO_SHA_2X',
 'CHAOS',
 'CHAOS-MMA',
 'MMA_SHA_2C',
 'MMA_SHA_2F',
 'MIO_SHA_2C',
 'MIO_SHA_2D',
 'SwarmCI']

TOP

Get information about one or more models.#

It is possible to get information about one or more specific models using the SwarmRequest.get_model_info() method:

SwarmRequest.get_model_info(models=None, custom_model=None, original_response=False)

Parameters:

  • models (list[str], optional): models as a list of strings. If the list is not provided, returns information about all the available magnetic models.

  • custom_model (str, optional): name of the file containing the spherical harmonics coefficients (custom model).

  • original_response (bool, optional): if set to False (default), returns the result as a dictionary. If set to True, returns the result as a list of dictionaries.

Example: get info about all the available magnetic models:

# Import SwarmRequest object (this step can be skipped if SwarmRequest has been already imported)
from viresclient import SwarmRequest

# Create the request object
request = SwarmRequest()

# Get model info
request.get_model_info()
{'AMPS': {'expression': 'AMPS()',
  'validity': {'start': '1900-01-01T00:00:00Z', 'end': '2025-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2E_00000000T000000_99999999T999999_0104']},
 'CHAOS': {'expression': "'CHAOS-Core'(max_degree=20,min_degree=1) + 'CHAOS-Static'(max_degree=185,min_degree=21) + 'CHAOS-MMA-Primary'(max_degree=2,min_degree=1) + 'CHAOS-MMA-Secondary'(max_degree=2,min_degree=1)",
  'validity': {'start': '2000-01-01T00:00:00Z', 'end': '2024-01-24T19:30:00Z'},
  'sources': ['CHAOS-7_static.shc',
   'SW_OPER_MCO_SHA_2X_19970101T000000_20240207T235959_0716',
   'SW_OPER_MMA_CHAOS__20000101T000000_20001231T233000_0704',
   'SW_OPER_MMA_CHAOS__20010101T000000_20011231T233000_0704',
   'SW_OPER_MMA_CHAOS__20020101T000000_20021231T233000_0704',
   'SW_OPER_MMA_CHAOS__20030101T000000_20031231T233000_0704',
   'SW_OPER_MMA_CHAOS__20040101T000000_20041231T233000_0704',
   'SW_OPER_MMA_CHAOS__20050101T000000_20051231T233000_0704',
   'SW_OPER_MMA_CHAOS__20060101T000000_20061231T233000_0704',
   'SW_OPER_MMA_CHAOS__20070101T000000_20071231T233000_0704',
   'SW_OPER_MMA_CHAOS__20080101T000000_20081231T233000_0704',
   'SW_OPER_MMA_CHAOS__20090101T000000_20091231T233000_0704',
   'SW_OPER_MMA_CHAOS__20100101T000000_20101231T233000_0704',
   'SW_OPER_MMA_CHAOS__20110101T000000_20111231T233000_0704',
   'SW_OPER_MMA_CHAOS__20120101T000000_20121231T233000_0704',
   'SW_OPER_MMA_CHAOS__20130101T000000_20131231T233000_0704',
   'SW_OPER_MMA_CHAOS__20140101T000000_20141231T233000_0704',
   'SW_OPER_MMA_CHAOS__20150101T000000_20151231T233000_0704',
   'SW_OPER_MMA_CHAOS__20160101T000000_20161231T233000_0704',
   'SW_OPER_MMA_CHAOS__20170101T000000_20171231T233000_0704',
   'SW_OPER_MMA_CHAOS__20180101T000000_20181231T233000_0704',
   'SW_OPER_MMA_CHAOS__20190101T000000_20191231T233000_0704',
   'SW_OPER_MMA_CHAOS__20200101T000000_20201231T233000_0708',
   'SW_OPER_MMA_CHAOS__20210101T000000_20211231T233000_0712',
   'SW_OPER_MMA_CHAOS__20220101T000000_20221231T233000_0716',
   'SW_OPER_MMA_CHAOS__20230101T000000_20240124T193000_0716']},
 'CHAOS-Core': {'expression': "'CHAOS-Core'(max_degree=20,min_degree=1)",
  'validity': {'start': '1997-02-07T05:23:17.067838Z',
   'end': '2024-02-07T13:50:52.834559Z'},
  'sources': ['SW_OPER_MCO_SHA_2X_19970101T000000_20240207T235959_0716']},
 'CHAOS-MMA': {'expression': "'CHAOS-MMA-Primary'(max_degree=2,min_degree=1) + 'CHAOS-MMA-Secondary'(max_degree=2,min_degree=1)",
  'validity': {'start': '2000-01-01T00:00:00Z', 'end': '2024-01-24T19:30:00Z'},
  'sources': ['SW_OPER_MMA_CHAOS__20000101T000000_20001231T233000_0704',
   'SW_OPER_MMA_CHAOS__20010101T000000_20011231T233000_0704',
   'SW_OPER_MMA_CHAOS__20020101T000000_20021231T233000_0704',
   'SW_OPER_MMA_CHAOS__20030101T000000_20031231T233000_0704',
   'SW_OPER_MMA_CHAOS__20040101T000000_20041231T233000_0704',
   'SW_OPER_MMA_CHAOS__20050101T000000_20051231T233000_0704',
   'SW_OPER_MMA_CHAOS__20060101T000000_20061231T233000_0704',
   'SW_OPER_MMA_CHAOS__20070101T000000_20071231T233000_0704',
   'SW_OPER_MMA_CHAOS__20080101T000000_20081231T233000_0704',
   'SW_OPER_MMA_CHAOS__20090101T000000_20091231T233000_0704',
   'SW_OPER_MMA_CHAOS__20100101T000000_20101231T233000_0704',
   'SW_OPER_MMA_CHAOS__20110101T000000_20111231T233000_0704',
   'SW_OPER_MMA_CHAOS__20120101T000000_20121231T233000_0704',
   'SW_OPER_MMA_CHAOS__20130101T000000_20131231T233000_0704',
   'SW_OPER_MMA_CHAOS__20140101T000000_20141231T233000_0704',
   'SW_OPER_MMA_CHAOS__20150101T000000_20151231T233000_0704',
   'SW_OPER_MMA_CHAOS__20160101T000000_20161231T233000_0704',
   'SW_OPER_MMA_CHAOS__20170101T000000_20171231T233000_0704',
   'SW_OPER_MMA_CHAOS__20180101T000000_20181231T233000_0704',
   'SW_OPER_MMA_CHAOS__20190101T000000_20191231T233000_0704',
   'SW_OPER_MMA_CHAOS__20200101T000000_20201231T233000_0708',
   'SW_OPER_MMA_CHAOS__20210101T000000_20211231T233000_0712',
   'SW_OPER_MMA_CHAOS__20220101T000000_20221231T233000_0716',
   'SW_OPER_MMA_CHAOS__20230101T000000_20240124T193000_0716']},
 'CHAOS-MMA-Primary': {'expression': "'CHAOS-MMA-Primary'(max_degree=2,min_degree=1)",
  'validity': {'start': '2000-01-01T00:00:00Z', 'end': '2024-01-24T19:30:00Z'},
  'sources': ['SW_OPER_MMA_CHAOS__20000101T000000_20001231T233000_0704',
   'SW_OPER_MMA_CHAOS__20010101T000000_20011231T233000_0704',
   'SW_OPER_MMA_CHAOS__20020101T000000_20021231T233000_0704',
   'SW_OPER_MMA_CHAOS__20030101T000000_20031231T233000_0704',
   'SW_OPER_MMA_CHAOS__20040101T000000_20041231T233000_0704',
   'SW_OPER_MMA_CHAOS__20050101T000000_20051231T233000_0704',
   'SW_OPER_MMA_CHAOS__20060101T000000_20061231T233000_0704',
   'SW_OPER_MMA_CHAOS__20070101T000000_20071231T233000_0704',
   'SW_OPER_MMA_CHAOS__20080101T000000_20081231T233000_0704',
   'SW_OPER_MMA_CHAOS__20090101T000000_20091231T233000_0704',
   'SW_OPER_MMA_CHAOS__20100101T000000_20101231T233000_0704',
   'SW_OPER_MMA_CHAOS__20110101T000000_20111231T233000_0704',
   'SW_OPER_MMA_CHAOS__20120101T000000_20121231T233000_0704',
   'SW_OPER_MMA_CHAOS__20130101T000000_20131231T233000_0704',
   'SW_OPER_MMA_CHAOS__20140101T000000_20141231T233000_0704',
   'SW_OPER_MMA_CHAOS__20150101T000000_20151231T233000_0704',
   'SW_OPER_MMA_CHAOS__20160101T000000_20161231T233000_0704',
   'SW_OPER_MMA_CHAOS__20170101T000000_20171231T233000_0704',
   'SW_OPER_MMA_CHAOS__20180101T000000_20181231T233000_0704',
   'SW_OPER_MMA_CHAOS__20190101T000000_20191231T233000_0704',
   'SW_OPER_MMA_CHAOS__20200101T000000_20201231T233000_0708',
   'SW_OPER_MMA_CHAOS__20210101T000000_20211231T233000_0712',
   'SW_OPER_MMA_CHAOS__20220101T000000_20221231T233000_0716',
   'SW_OPER_MMA_CHAOS__20230101T000000_20240124T193000_0716']},
 'CHAOS-MMA-Secondary': {'expression': "'CHAOS-MMA-Secondary'(max_degree=2,min_degree=1)",
  'validity': {'start': '2000-01-01T00:00:00Z', 'end': '2024-01-24T19:30:00Z'},
  'sources': ['SW_OPER_MMA_CHAOS__20000101T000000_20001231T233000_0704',
   'SW_OPER_MMA_CHAOS__20010101T000000_20011231T233000_0704',
   'SW_OPER_MMA_CHAOS__20020101T000000_20021231T233000_0704',
   'SW_OPER_MMA_CHAOS__20030101T000000_20031231T233000_0704',
   'SW_OPER_MMA_CHAOS__20040101T000000_20041231T233000_0704',
   'SW_OPER_MMA_CHAOS__20050101T000000_20051231T233000_0704',
   'SW_OPER_MMA_CHAOS__20060101T000000_20061231T233000_0704',
   'SW_OPER_MMA_CHAOS__20070101T000000_20071231T233000_0704',
   'SW_OPER_MMA_CHAOS__20080101T000000_20081231T233000_0704',
   'SW_OPER_MMA_CHAOS__20090101T000000_20091231T233000_0704',
   'SW_OPER_MMA_CHAOS__20100101T000000_20101231T233000_0704',
   'SW_OPER_MMA_CHAOS__20110101T000000_20111231T233000_0704',
   'SW_OPER_MMA_CHAOS__20120101T000000_20121231T233000_0704',
   'SW_OPER_MMA_CHAOS__20130101T000000_20131231T233000_0704',
   'SW_OPER_MMA_CHAOS__20140101T000000_20141231T233000_0704',
   'SW_OPER_MMA_CHAOS__20150101T000000_20151231T233000_0704',
   'SW_OPER_MMA_CHAOS__20160101T000000_20161231T233000_0704',
   'SW_OPER_MMA_CHAOS__20170101T000000_20171231T233000_0704',
   'SW_OPER_MMA_CHAOS__20180101T000000_20181231T233000_0704',
   'SW_OPER_MMA_CHAOS__20190101T000000_20191231T233000_0704',
   'SW_OPER_MMA_CHAOS__20200101T000000_20201231T233000_0708',
   'SW_OPER_MMA_CHAOS__20210101T000000_20211231T233000_0712',
   'SW_OPER_MMA_CHAOS__20220101T000000_20221231T233000_0716',
   'SW_OPER_MMA_CHAOS__20230101T000000_20240124T193000_0716']},
 'CHAOS-Static': {'expression': "'CHAOS-Static'(max_degree=185,min_degree=21)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['CHAOS-7_static.shc']},
 'IGRF': {'expression': 'IGRF(max_degree=13,min_degree=1)',
  'validity': {'start': '1900-01-01T00:00:00Z', 'end': '2025-01-01T00:00:00Z'},
  'sources': ['SW_OPER_AUX_IGR_2__19000101T000000_20241231T235959_0103']},
 'LCS-1': {'expression': "'LCS-1'(max_degree=185,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['LCS-1.shc']},
 'MCO_SHA_2C': {'expression': 'MCO_SHA_2C(max_degree=18,min_degree=1)',
  'validity': {'start': '2013-11-24T18:34:03.360004Z',
   'end': '2023-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MCO_SHA_2C_20131125T000000_20230101T000000_0901']},
 'MCO_SHA_2D': {'expression': 'MCO_SHA_2D(max_degree=20,min_degree=1)',
  'validity': {'start': '2013-11-25T12:00:00.000003Z',
   'end': '2018-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MCO_SHA_2D_20131126T000000_20180101T000000_0401']},
 'MCO_SHA_2X': {'expression': "'CHAOS-Core'(max_degree=20,min_degree=1)",
  'validity': {'start': '1997-02-07T05:23:17.067838Z',
   'end': '2024-02-07T13:50:52.834559Z'},
  'sources': ['SW_OPER_MCO_SHA_2X_19970101T000000_20240207T235959_0716']},
 'MF7': {'expression': 'MF7(max_degree=133,min_degree=16)',
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['MF7.shc']},
 'MIO_SHA_2C': {'expression': "'MIO_SHA_2C-Primary'(max_degree=60,min_degree=1) + 'MIO_SHA_2C-Secondary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901']},
 'MIO_SHA_2C-Primary': {'expression': "'MIO_SHA_2C-Primary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901']},
 'MIO_SHA_2C-Secondary': {'expression': "'MIO_SHA_2C-Secondary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901']},
 'MIO_SHA_2D': {'expression': "'MIO_SHA_2D-Primary'(max_degree=60,min_degree=1) + 'MIO_SHA_2D-Secondary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2D_20131201T000000_20220531T235959_0801']},
 'MIO_SHA_2D-Primary': {'expression': "'MIO_SHA_2D-Primary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2D_20131201T000000_20220531T235959_0801']},
 'MIO_SHA_2D-Secondary': {'expression': "'MIO_SHA_2D-Secondary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2D_20131201T000000_20220531T235959_0801']},
 'MLI_SHA_2C': {'expression': 'MLI_SHA_2C(max_degree=120,min_degree=16)',
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MLI_SHA_2C_00000000T000000_99999999T999999_0901']},
 'MLI_SHA_2D': {'expression': 'MLI_SHA_2D(max_degree=133,min_degree=16)',
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MLI_SHA_2D_00000000T000000_99999999T999999_0501']},
 'MLI_SHA_2E': {'expression': 'MLI_SHA_2E(max_degree=1319,min_degree=16)',
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MLI_SHA_2E_00000000T000000_99999999T999999_0801']},
 'MMA_SHA_2C': {'expression': "'MMA_SHA_2C-Primary'(max_degree=2,min_degree=1) + 'MMA_SHA_2C-Secondary'(max_degree=3,min_degree=1)",
  'validity': {'start': '2013-11-25T03:00:00Z', 'end': '2018-12-31T21:00:00Z'},
  'sources': ['SW_OPER_MMA_SHA_2C_20131125T000000_20181231T235959_0501']},
 'MMA_SHA_2C-Primary': {'expression': "'MMA_SHA_2C-Primary'(max_degree=2,min_degree=1)",
  'validity': {'start': '2013-11-25T03:00:00Z', 'end': '2018-12-31T21:00:00Z'},
  'sources': ['SW_OPER_MMA_SHA_2C_20131125T000000_20181231T235959_0501']},
 'MMA_SHA_2C-Secondary': {'expression': "'MMA_SHA_2C-Secondary'(max_degree=3,min_degree=1)",
  'validity': {'start': '2013-11-25T03:00:00Z', 'end': '2018-12-31T21:00:00Z'},
  'sources': ['SW_OPER_MMA_SHA_2C_20131125T000000_20181231T235959_0501']},
 'MMA_SHA_2F': {'expression': "'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1) + 'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)",
  'validity': {'start': '2013-11-25T11:15:00Z', 'end': '2024-01-20T21:45:00Z'},
  'sources': ['SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108']},
 'MMA_SHA_2F-Primary': {'expression': "'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1)",
  'validity': {'start': '2013-11-25T11:15:00Z', 'end': '2024-01-20T21:45:00Z'},
  'sources': ['SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108']},
 'MMA_SHA_2F-Secondary': {'expression': "'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)",
  'validity': {'start': '2013-11-25T11:15:00Z', 'end': '2024-01-20T21:45:00Z'},
  'sources': ['SW_OPER_MMA_SHA_2F_20131125T103000_20140101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20140101T000000_20150101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20150101T000000_20160101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20160101T000000_20170101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20170101T000000_20180101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20180101T000000_20190101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20190101T000000_20200101T000000_0108',
   'SW_OPER_MMA_SHA_2F_20200101T000000_20201231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20210101T000000_20211231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20220101T000000_20221231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20230101T000000_20231231T223000_0108',
   'SW_OPER_MMA_SHA_2F_20240101T000000_20240120T223000_0108']},
 'SwarmCI': {'expression': "MCO_SHA_2C(max_degree=18,min_degree=1) + MLI_SHA_2C(max_degree=120,min_degree=16) + 'MMA_SHA_2C-Primary'(max_degree=2,min_degree=1) + 'MMA_SHA_2C-Secondary'(max_degree=3,min_degree=1) + 'MIO_SHA_2C-Primary'(max_degree=60,min_degree=1) + 'MIO_SHA_2C-Secondary'(max_degree=60,min_degree=1)",
  'validity': {'start': '2013-11-25T03:00:00Z', 'end': '2018-12-31T21:00:00Z'},
  'sources': ['SW_OPER_MCO_SHA_2C_20131125T000000_20230101T000000_0901',
   'SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901',
   'SW_OPER_MLI_SHA_2C_00000000T000000_99999999T999999_0901',
   'SW_OPER_MMA_SHA_2C_20131125T000000_20181231T235959_0501']},
 '_MIO_SHA_2C': {'expression': "'_MIO_SHA_2C-Primary'(max_degree=60,min_degree=1) + '_MIO_SHA_2C-Secondary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901']},
 '_MIO_SHA_2C-Primary': {'expression': "'_MIO_SHA_2C-Primary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901']},
 '_MIO_SHA_2C-Secondary': {'expression': "'_MIO_SHA_2C-Secondary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_0901']},
 '_MIO_SHA_2D': {'expression': "'_MIO_SHA_2D-Primary'(max_degree=60,min_degree=1) + '_MIO_SHA_2D-Secondary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2D_20131201T000000_20220531T235959_0801']},
 '_MIO_SHA_2D-Primary': {'expression': "'_MIO_SHA_2D-Primary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2D_20131201T000000_20220531T235959_0801']},
 '_MIO_SHA_2D-Secondary': {'expression': "'_MIO_SHA_2D-Secondary'(max_degree=60,min_degree=1)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['SW_OPER_MIO_SHA_2D_20131201T000000_20220531T235959_0801']}}

Example: get info about CHAOS-Core and CHAOS-Static:

request.get_model_info(models=['CHAOS-Core', 'CHAOS-Static'])
{'CHAOS-Core': {'expression': "'CHAOS-Core'(max_degree=20,min_degree=1)",
  'validity': {'start': '1997-02-07T05:23:17.067838Z',
   'end': '2024-02-07T13:50:52.834559Z'},
  'sources': ['SW_OPER_MCO_SHA_2X_19970101T000000_20240207T235959_0716']},
 'CHAOS-Static': {'expression': "'CHAOS-Static'(max_degree=185,min_degree=21)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['CHAOS-7_static.shc']}}

Example: set original_response=True to get the result as a list of dictionaries:

request.get_model_info(models=['CHAOS-Core', 'CHAOS-Static'], original_response=True)
[{'name': 'CHAOS-Core',
  'expression': "'CHAOS-Core'(max_degree=20,min_degree=1)",
  'validity': {'start': '1997-02-07T05:23:17.067838Z',
   'end': '2024-02-07T13:50:52.834559Z'},
  'sources': ['SW_OPER_MCO_SHA_2X_19970101T000000_20240207T235959_0716']},
 {'name': 'CHAOS-Static',
  'expression': "'CHAOS-Static'(max_degree=185,min_degree=21)",
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': ['CHAOS-7_static.shc']}]

Example: get info on a custom model by providing the name of the file containing its coefficients:

# Download shc file with WGET (command line tool)
!wget "http://www.spacecenter.dk/files/magnetic-models/LCS-1/LCS-1.shc"

# Upload a .shc file and update the file name
request.get_model_info(custom_model='LCS-1.shc')
--2024-01-24 17:42:47--  http://www.spacecenter.dk/files/magnetic-models/LCS-1/LCS-1.shc
Resolving www.spacecenter.dk (www.spacecenter.dk)... 
130.226.216.199
Connecting to www.spacecenter.dk (www.spacecenter.dk)|130.226.216.199|:80... 
connected.
HTTP request sent, awaiting response... 
200 OK
Length: 657666 (642K) [text/plain]
Saving to: ‘LCS-1.shc’


LCS-1.shc             0%[                    ]       0  --.-KB/s               
LCS-1.shc             9%[>                   ]  62.35K   312KB/s               
LCS-1.shc            38%[======>             ] 246.42K   616KB/s               
LCS-1.shc           100%[===================>] 642.25K  1.22MB/s    in 0.5s    

2024-01-24 17:42:48 (1.22 MB/s) - ‘LCS-1.shc’ saved [657666/657666]
{'Custom_Model': {'expression': 'Custom_Model(max_degree=185,min_degree=1)',
  'validity': {'start': '0001-01-01T00:00:00Z', 'end': '4000-01-01T00:00:00Z'},
  'sources': []}}
# Delete downloaded file(s)
!rm LCS-1.shc*

TOP

Get the orbit number#

The SwarmRequest.get_orbit_number() allows to get the orbit number of a given spacecraft providing date and time:

SwarmRequest.get_orbit_number(spacecraft, input_time)

Parameters:

  • spacecraft (str): spacecraft identifier: A, B or C.

  • input_time (datetime.datetime or str): date and time.

Example: get orbit numbers corresponding to date 2020-01-01 00:00:00 for the three spacecrafts:

# Create the request object
request = SwarmRequest()

# Get results
for sc in ('A', 'B', 'C'):
    orbit = request.get_orbit_number(sc, '2020-01-01T00:00:00')
    print(f's/c {sc}: {orbit}')
/opt/conda/lib/python3.11/site-packages/viresclient/_client_swarm.py:2031: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
  return df["OrbitNumber"][0]
s/c A: 34324
/opt/conda/lib/python3.11/site-packages/viresclient/_client_swarm.py:2031: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
  return df["OrbitNumber"][0]
s/c B: 33892
s/c C: 34320
/opt/conda/lib/python3.11/site-packages/viresclient/_client_swarm.py:2031: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
  return df["OrbitNumber"][0]

TOP

Get times for orbits#

Get the time interval corresponding to a pair of orbit numbers using the SwarmRequest.get_times_for_orbits() method:

SwarmRequest.get_times_for_orbits(spacecraft, start_orbit, end_orbit)

Parameters:

  • spacecraft (str): spacecraft identifier: A, B or C.

  • start_orbit (int): start orbit number

  • end_orbit (int): end orbit number

Example: get time intervals corresponding to start_orbit 1000 and end_orbit 2000 for the three spacecrafts:

# Import SwarmRequest object (this step can be skipped if SwarmRequest has been already imported)
from viresclient import SwarmRequest

# Set start/end orbits
start_orbit = 1000
end_orbit = 2000

# Create the request object
request = SwarmRequest()

# Get results
for sc in ('A', 'B', 'C'):
    start_date, end_date = request.get_times_for_orbits(sc, start_orbit, end_orbit)
    print(f's/c {sc}: {start_date} - {end_date}')
/opt/conda/lib/python3.11/site-packages/viresclient/_client_swarm.py:1900: FutureWarning: The order of SwarmRequest.get_times_for_orbits() method's parameters has changed!  The backward compatibility will be removed in the future.  Please change your code to:  request.get_times_for_orbits(start_orbit, end_orbit, 'Swarm', spacecraft)
  warn(
s/c A: 2014-01-27 04:05:04.228954 - 2014-04-02 13:51:01.875996
s/c B: 2014-01-27 04:04:17.157955 - 2014-04-03 00:46:19.552012
s/c C: 2014-01-27 04:08:31.127006 - 2014-04-02 19:45:08.510983

TOP

Set collections#

Before sending the request to the server, you need to set the Swarm collection including the measurement(s) of interest. This can be done using the SwarmRequest.set_collection() method:

SwarmRequest.set_collection(*args)

Parameters:

  • *args (str): one or more collections (see Get available collections) as a string.

Example: to get data from SW_OPER_MAGA_LR_1B and SW_OPER_EFIA_LP_1B collections:

# Import SwarmRequest object (this step can be skipped if SwarmRequest has been already imported)
from viresclient import SwarmRequest

# Create the request object
request = SwarmRequest()

# Set collections
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
<viresclient._client_swarm.SwarmRequest at 0x7fee97649050>

TOP

Set products#

After setting the collection, you must set the combination of measurements and/or auxiliaries and/or magnetic model(s) data to retrieve. This can be done using the SwarmRequest.set_products() method:

SwarmRequest.set_products(measurements=None, models=None, custom_model=None, auxiliaries=None, residuals=False, sampling_step=None)

Parameters:

  • measurements (list[str], optional): list of measurements to be downloaded. To get the list of the available measurements see Available measurements (e.g.: ['F', 'B_NEC', 'Ne'].).

  • models (list[str], optional): list of magnetic models. To get the list of the available models see Available models (e.g.: ['CHAOS-Core', 'CHAOS-Static']). In addition to the list, this parameters accepts also expression for the definition of magnetic models (e.g.: 'CHAOS = "CHAOS-Core" + "CHAOS-Static"').

  • custom_model (str, optional): path to the the file containing the spherical harmonics coefficients of the custom model.

  • auxiliaries (list[str], optional): list of auxiliaries to be downloaded. To get the list of the available auxiliaries see Available auxiliaries. Please note that the following parameters are always retrieved (i.e. they don’t need to be specified): Spacecraft, Timestamp, Latitude, Longitude, Radius.

  • residuals (bool, optional): if it is set to True, returns the residuals between measurements (specified with measurements) and models (specified with models). If it is set to False (default), returns measurements and models.

  • sampling_step (str, optional): set the sampling step as an ISO 8601 time interval. If not provided, data is returned with the original sampling.

Example: get measurements: F and B_NEC from SW_OPER_MAGA_LR_1B and Ne from SW_OPER_EFIA_LP_1B, model CHAOS = "CHAOS-Core" + "Chaos-Static" and auxiliary OrbitNumber with a sampling step of 10 seconds:

# Import SwarmRequest object (this step can be skipped if SwarmRequest has been already imported)
from viresclient import SwarmRequest

# Create the request object
request = SwarmRequest()

# Set collections
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')

# Set products
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
<viresclient._client_swarm.SwarmRequest at 0x7fee9764bf10>

TOP

Set/clear filters#

Filter(s) can be applied to the requested measurements using the SwarmRequest.set_range_filter() method:

SwarmRequest.set_range_filter(parameter=None, minimum=None, maximum=None)

This method allows to set filter(s) in the form: \(minimum \le parameter \le maximum\).

Parameters:

  • parameter (str, optional): parameter to be used as a filter (e.g. Latitude)

  • minimum (float, optional): allowed minimum value

  • maximum (float, optional): allowed maximum value

It is possible to apply multiple filters with consecutive calls to this method.

Example: to set filter: -20 <= Longitude <= 50 and 30 <= Latitude <= 70:

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Create the request object
request = SwarmRequest()

# Set collection
request.set_collection('SW_OPER_MAGA_LR_1B')

# Set product
request.set_products(measurements=['F', 'B_NEC'])

# Set filters
request.set_range_filter('Longitude', -20.0, 50.0)
request.set_range_filter('Latitude', 30.0, 70.0)
<viresclient._client_swarm.SwarmRequest at 0x7fee97ca20d0>

Filters can be removed using the SwarmRequest.clear_range_filter() method:

SwarmRequest.clear_range_filter()
request.clear_range_filter()
<viresclient._client_swarm.SwarmRequest at 0x7fee97ca20d0>

TOP

Send request to the server#

After setting collection(s), measurements, auxiliaries and models, we are ready to send the request to the server using the SwarmRequest.get_between() method:

SwarmRequest.get_between(start_time=None, end_time=None, filetype='cdf', asynchronous=True, show_progress=True, nrecords_limit=None, tmpdir=None)

Parameters:

  • start_time (datetime.datetime or str, optional): lower bound of temporal interval. If provided as string, it must be compliant to ISO-8601.

  • end_time (datetime.datetime or str, optional): upper bound of temporal interval. If provided as string, it must be compliant to ISO-8601.

  • filetype (str, optional): file format. Allowed values: csv and cdf (default).

  • asynchronous (bool, optional): if True (default), set the asynchronous processing.

  • show_progress (bool, optional): if True (default), enable the progress bar while processing and downloading data.

  • nrecords_limit (int): overrides the limit of 3456000 records.

Example: download data according to the following inut parameters and get the list of source data files:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T00:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Create the request object
request = SwarmRequest()

# Set collections
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')

# Set products
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)

# Get data
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')

Data is returned as a ReturnedData object:

type(data)
viresclient._data_handling.ReturnedData

TOP

Handle downloaded data - ReturnedData#

Once the server receives the user’s request, it creates the product, than this product is automatically downloaded and returned to the client as a ReturnedData object. Thus you don’t need to create it by yourself. It is now possible to convert this data to a pandas.DataFrame object or to a xarray.Dataset object or to save it to one or more files.

ReturnedData object has the following attributes:

  • ReturnedData.sources

  • ReturnedData.contents

  • ReturnedData.file_types

  • ReturnedData.magnetic_models

  • ReturnedData.data_filters

and the following methods:

  • ReturnedData.as_dataframe()

  • ReturnedData.as_xarray()

  • ReturnedData.to_file()

  • ReturnedData.to_files()

TOP

Get the list of source data#

This attribute contains the list of source data files from which the values have been extracted.

Example: download data according to the following inut parameters and get the list of source data files:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T00:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Get list of sources
data.sources
['CHAOS-7_static.shc',
 'SW_OPER_AUXAORBCNT_20131122T132146_20240125T225347_0001',
 'SW_OPER_EFIA_LP_1B_20190930T000000_20190930T235959_0602_MDR_EFI_LP',
 'SW_OPER_EFIA_LP_1B_20191001T000000_20191001T235959_0602_MDR_EFI_LP',
 'SW_OPER_MCO_SHA_2X_19970101T000000_20240207T235959_0716',
 'SW_PREL_MAGA_LR_1B_20190930T000000_20190930T235959_0604_MDR_MAG_LR',
 'SW_PREL_MAGA_LR_1B_20191001T000000_20191001T235959_0604_MDR_MAG_LR']

This is the list of the files from which the measurement and auxiliaries values and the magnetic models values have been retrieved.

TOP

ReturnedData contents#

Downloaded data is saved to one or more temporary files represente as ReturnedDataFile objects. The ReturnedData.contents attribute contains the list of these objects.

Example: download data according to the following inut parameters and get the ReturnedData contents:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T00:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Get the ReturnedData contents
data.contents
[<viresclient._data_handling.ReturnedDataFile at 0x7fee97683f90>]

TOP

Get type of downloaded data files#

This attribute contains the type of downloaded files (i.e. cdf or csv).

Example: download data according to the following inut parameters and get the ReturnedData file type:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T00:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')

# Get ReturnedData file type
data.filetype
'cdf'

TOP

Get list of magnetic models used during calculations#

This attribute contains the list of the magnetic models used during calculations.

Example: get F and B_NEC from SW_OPER_MAGA_LR_1B, Ne from SW_OPER_EFIA_LP_1B, model CHAOS = “CHAOS-Core” + “Chaos-Static” and auxiliary OrbitNumber with a sampling step of 10 seconds, between 2019-10-01T00:00:00 and 2019-10-01T01:00:00 in CDF format and get the list of magnetic models used during calculations:

Example: download data according to the following inut parameters and get the list of magnetic models:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T01:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Get magnetic models
data.magnetic_models
["CHAOS = 'CHAOS-Core'(max_degree=20,min_degree=1) + 'CHAOS-Static'(max_degree=185,min_degree=21)"]

TOP

Get list of filters applied to the request#

This attribute contains the list of applied filters

Example: download data according to the following inut parameters and get the list of the applied filters:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-02T00:00:00]

  • file format: CDF

  • filters:

    • Longitude: \([-20.0, 50.0]\)

    • Latitude: \([30.0, 70.0]\)

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
request.set_range_filter('Longitude', -20.0, 50.0)
request.set_range_filter('Latitude', 30.0, 70.0)
data = request.get_between('2019-10-01T00:00:00', '2019-10-02T00:00:00')
# Get list of applied filters
data.data_filters
['Latitude <= 70.0',
 'Latitude >= 30.0',
 'Longitude <= 50.0',
 'Longitude >= -20.0']

TOP

Convert ReturnedData to Pandas DataFrame#

Data downloaded from the server can be converted to a pandas.DataFrame object. This is a general 2D labeled, size-mutable tabular structure with potentially heterogeneously-typed column allowing the user to directly access data. For more information:

This conversion can be obtained with the ReturnedData.as_dataframe() method:

ReturnedData.as_dataframe(expand=False)

Parameters:

  • expand (bool, optional): If set to False (default), the vector parameters are represented as arrays (i.e. all the vector components in the same column). If this parameter is stet to True, the vector parameters are expanded (i.e. each component in a separate column).

Example: download data according to the following inut parameters and convert the ReturnedData object to a pandas DataFrame:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T01:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Convert ReturnedData to pandas DataFrame
df = data.as_dataframe()

You can visualize the first 5 records using the DataFrame.head() method:

df.head()
Longitude F_CHAOS Latitude Spacecraft F OrbitNumber B_NEC Radius B_NEC_CHAOS Ne
Timestamp
2019-10-01 00:00:00 37.641385 26240.730535 -33.130184 A 26245.7441 32904 [11030.74599408242, -6220.704487542828, -22988... 6820061.62 [11046.099554893428, -6220.959975166424, -2297... 108830.9
2019-10-01 00:00:10 37.642219 26276.333966 -33.771114 A 26281.6953 32904 [10910.828610800841, -6343.943385906063, -2305... 6820113.70 [10925.653714752561, -6344.469715640605, -2303... 116231.7
2019-10-01 00:00:20 37.643695 26316.346941 -34.412011 A 26322.0452 32904 [10798.145737351697, -6466.743744687149, -2311... 6820164.75 [10812.632715550953, -6467.028758448504, -2310... 116226.5
2019-10-01 00:00:30 37.645838 26360.944150 -35.052873 A 26366.9577 32904 [10692.764217196278, -6588.501254591764, -2318... 6820214.81 [10706.856845135577, -6588.651972445347, -2317... 120598.5
2019-10-01 00:00:40 37.648675 26410.297681 -35.693700 A 26416.6195 32904 [10594.25931399923, -6709.143214488952, -23250... 6820263.86 [10608.127334830202, -6709.332483418105, -2323... 129792.6

Setting expand=True:

df = data.as_dataframe(expand=True)

each vector component is in a separate column:

df.head()
Longitude F_CHAOS Latitude Spacecraft F OrbitNumber Radius Ne B_NEC_CHAOS_N B_NEC_CHAOS_E B_NEC_CHAOS_C B_NEC_N B_NEC_E B_NEC_C
Timestamp
2019-10-01 00:00:00 37.641385 26240.730535 -33.130184 A 26245.7441 32904 6820061.62 108830.9 11046.099555 -6220.959975 -22975.188369 11030.745994 -6220.704488 -22988.492021
2019-10-01 00:00:10 37.642219 26276.333966 -33.771114 A 26281.6953 32904 6820113.70 116231.7 10925.653715 -6344.469716 -23039.607671 10910.828611 -6343.943386 -23053.049285
2019-10-01 00:00:20 37.643695 26316.346941 -34.412011 A 26322.0452 32904 6820164.75 116226.5 10812.632716 -6467.028758 -23104.428777 10798.145737 -6466.743745 -23117.926901
2019-10-01 00:00:30 37.645838 26360.944150 -35.052873 A 26366.9577 32904 6820214.81 120598.5 10706.856845 -6588.651972 -23170.072468 10692.764217 -6588.501255 -23183.591704
2019-10-01 00:00:40 37.648675 26410.297681 -35.693700 A 26416.6195 32904 6820263.86 129792.6 10608.127335 -6709.332483 -23236.960121 10594.259314 -6709.143214 -23250.685241

TOP

Convert ReturnedData to xarray Dataset#

Data downloaded from the server can be converted to a xarray.Dataset object. This is a multi-dimentional array allowing the user to directly access data. For more information:

This conversion can be obtained with the ReturnedData.as_xarray().

Example: download data according to the following inut parameters and convert the ReturnedData object to an xarray Dataset:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T01:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Convert ReturnedData to pandas DataFrame
ds = data.as_xarray()

You can se how the xarray Dataset is represented:

ds
<xarray.Dataset>
Dimensions:      (Timestamp: 360, NEC: 3)
Coordinates:
  * Timestamp    (Timestamp) datetime64[ns] 2019-10-01 ... 2019-10-01T00:59:50
  * NEC          (NEC) <U1 'N' 'E' 'C'
Data variables:
    Spacecraft   (Timestamp) object 'A' 'A' 'A' 'A' 'A' ... 'A' 'A' 'A' 'A' 'A'
    Longitude    (Timestamp) float64 37.64 37.64 37.64 ... -139.6 -137.9 -135.9
    F_CHAOS      (Timestamp) float64 2.624e+04 2.628e+04 ... 4.748e+04 4.745e+04
    Latitude     (Timestamp) float64 -33.13 -33.77 -34.41 ... 82.09 82.69 83.29
    F            (Timestamp) float64 2.625e+04 2.628e+04 ... 4.749e+04 4.746e+04
    OrbitNumber  (Timestamp) int32 32904 32904 32904 32904 ... 32905 32905 32905
    B_NEC        (Timestamp, NEC) float64 1.103e+04 -6.221e+03 ... 4.744e+04
    Radius       (Timestamp) float64 6.82e+06 6.82e+06 ... 6.803e+06 6.803e+06
    B_NEC_CHAOS  (Timestamp, NEC) float64 1.105e+04 -6.221e+03 ... 4.744e+04
    Ne           (Timestamp) float64 1.088e+05 1.162e+05 ... 4.102e+04 3.138e+04
Attributes:
    Sources:         ['CHAOS-7_static.shc', 'SW_OPER_AUXAORBCNT_20131122T1321...
    MagneticModels:  ["CHAOS = 'CHAOS-Core'(max_degree=20,min_degree=1) + 'CH...
    AppliedFilters:  []

TOP

Save downloaded data to a file#

Data downloaded from the server can be saved to a file using the ReturnedData.to_file() method:

ReturnedData.to_file(path, overwrite=False)

Parameters:

  • path (str): output file path.

  • overwrite (bool, optional):if True allows to overwrite the file if already present at path.

Example: download data according to the following inut parameters and save the ReturnedData object to a file:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T01:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Save ReturnedData to a file
data.to_file('out.cdf', overwrite=True)
Data written to out.cdf

Note: this method can be used only if the amount of downloaded data is small (i.e. if the request is not split between multiple requests).

Example: download data according to the following inut parameters and save the ReturnedData object to a file:

  • measurements: U_orbit, Ne, Te, Vs

  • magnetic models: none

  • auxiliaries: none

  • sampling step: default

  • time interval: [2019-10-01T00:00:00, 2019-11-01T00:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['U_orbit', 'Ne', 'Te', 'Vs'],
)
data = request.get_between('2019-10-01T00:00:00', '2019-11-01T00:00:00')

The request is split between multiple requests. Try to execute the cell below:

# data.to_file('huge.cdf', True)
## will return: 
## NotImplementedError: Data is split into multiple files. Use .to_files instead
# Remove saved files (if any)
!rm *.cdf

TOP

Save downloaded data to multiple files#

Data downloaded from the server can be saved to one or more files using the ReturnedData.to_files() method:

ReturnedData.to_files(paths, overwrite=False)

Parameters:

  • paths (list[str]): output files path as a list of strings.

  • overwrite (bool, optional):if True allows to overwrite the file if already present at path.

Example: download data according to the following inut parameters and save the ReturnedData object a file using the ReturnedData.to_files() method:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T01:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Save ReturnedData to a file
data.to_files(['out.cdf'], overwrite=True)
Data written to out.cdf

This method is very useful in case the request has been split between multiple requests

Example: download data according to the following inut parameters and save the ReturnedData object to a files:

  • measurements: U_orbit, Ne, Te, Vs

  • magnetic models: none

  • auxiliaries: none

  • sampling step: default

  • time interval: [2019-10-01T00:00:00, 2019-11-01T00:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['U_orbit', 'Ne', 'Te', 'Vs'],
)
data = request.get_between('2019-10-01T00:00:00', '2019-11-01T00:00:00')
# Save ReturnedData to files
data.to_files(['first.cdf', 'second.cdf'], overwrite=True)
Data written to first.cdf
Data written to second.cdf

Note: the number of files to be specified must be equal to the number of files indicated by the ReturnedData.contents attribute. In the above case:

data.contents
[<viresclient._data_handling.ReturnedDataFile at 0x7feec3f98750>,
 <viresclient._data_handling.ReturnedDataFile at 0x7fee9764bdd0>]
# Remove saved files (if any)
!rm *.cdf

TOP

Handle downloaded temporary data file - ReturnedDataFile#

This object holds the file downloaded from the server. Even if data has not ben saved to a file with the ReturnedData.to_files(), it is stored in a temporary file and automatically deleted when not needed anymore. As indicated in the “ReturnedData contents” section, you can get the list of the returned data files using the ReturnedData.contents attribute. Thus, you don’t need to create this object by yourself.

Note: the description of this object has been included for completeness only. You won’t need to use this object and its methods directly. To handle the downloaded data is preferable to use the ReturnedData object.

ReturnedDataFile object has the following attributes:

  • ReturnedDataFile._file

  • ReturnedDataFile.filetype

and the following methods:

  • ReturnedDataFile.as_dataframe()

  • ReturnedDataFile.as_xarray()

  • ReturnedDataFile.to_file()

TOP

Get the NamedTemporaryFile associated to a ReturnedDataFile#

The NamedTemporaryFile corresponding to the ReturnedDataFile is contained in the ReturnedDataFile._file attribute.

Example: download data according to the following inut parameters and get the NamedTemporaryFiles objects associated to ReturnedDataFiles:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T01:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Get ReturnedData contents
data.contents
[<viresclient._data_handling.ReturnedDataFile at 0x7feec3fd5a50>]

ReturnedData contains only one ReturnedDataFile. Let’s get the associated NamedTemporaryFile:

data.contents[0]._file
<tempfile._TemporaryFileWrapper at 0x7feec3fdd150>

tempfile.NamedTemporaryFile is part of the Python standard library. For more information see: https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile

TOP

Get type of the downloaded data file#

This attribute contains the type of downloaded files (i.e. cdf, csv or nc)

Example: download data according to the following inut parameters and get the file type of the ReturnedDataFile:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T01:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Get ReturnedData contents
data.contents
[<viresclient._data_handling.ReturnedDataFile at 0x7feec3fb3f90>]
# Get file type
data.contents[0].filetype
'cdf'

TOP

Convert ReturnedDataFile to Pandas Dataframe#

As for the ReturnedData object (see Convert ReturnedData to Pandas DataFrame), the ReturnedDataFile object can be converted to a Pandas DataFrame using the ReturnedDataFile.as_dataframe() method:

ReturnedDataFile.as_dataframe(expand=False)

Parameters:

  • expand (bool, optional): If set to False (default), the vector parameters are represented as arrays (i.e. all the vector components in the same column). If this parameter is stet to True, the vector parameters are expanded (i.e. each component in a separate column).

TOP

Convert ReturnedDataFile to xarray Dataset#

As for the ReturnedData object (see Convert ReturnedData to xarray Dataset), the ReturnedDataFile object can be converted to an xarray Dataset using the ReturnedDataFile.as_xarray() method:

ReturnedDataFile.as_xarray()

TOP

Save ReturnedDataFile object to a file#

Data stored in the ReturnedDataFile object can be saved to a file with the ReturnedDataFile.to_file() method:

ReturnedDataFile.to_file(path, overwrite=False)

Parameters:

  • path (str): output file path.

  • overwrite (bool, optional):if True allows to overwrite the file if already present at path.

Example: download data according to the following inut parameters and get the file type of the ReturnedDataFile:

  • measurements: F, B_NEC, Ne

  • magnetic models: CHAOS = “CHAOS-Core” + “Chaos-Static”

  • auxiliaries: OrbitNumber

  • sampling step: 10 seconds

  • time interval: [2019-10-01T00:00:00, 2019-10-01T01:00:00]

  • file format: CDF

  • filters: none

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B', 'SW_OPER_EFIA_LP_1B')
request.set_products(
    measurements=['F', 'B_NEC', 'Ne'],
    models=['CHAOS = "CHAOS-Core" + "CHAOS-Static"'],
    auxiliaries=['OrbitNumber'],
    residuals=False,
    sampling_step='PT10S'
)
data = request.get_between('2019-10-01T00:00:00', '2019-10-01T01:00:00')
# Save the ReturnedDataFile to a file
data.contents[0].to_file('out.cdf', overwrite=True)
Data written to out.cdf
# Remove saved files (if any)
!rm out.cdf

TOP

Handle viresclient configuration - ClientConfig#

You can acces the viresclient configuration using the ClientConfig class:

class viresclient.ClientConfig(path=None)

Parameters:

  • path (str, optional): path of the configuration file. If not specified, the default configuration file is assumed: ~/.viresclient.ini.

Example: create the ClientConfig object associated to the default configuration file:

# Import the ClientConfig
from viresclient import ClientConfig

# Create the ClientConfig object
default = ClientConfig()

ClientConfig object has the following attributes:

  • ClientConfig.path

  • ClientConfig.default_url

and the following methods:

  • ClientConfig.set_site_config()

  • ClientConfig.get_site_config()

  • ClientConfig.save()

TOP

Get path of the configuration file#

The ClientConfig.path read-only attribute contains the path of the configuration file.

Example: create the ClientConfig object associated to the default configuration file and check its path:

# Import the ClientConfig (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig

# Create the ClientConfig object
default = ClientConfig()

default.path
'/home/jovyan/.viresclient.ini'

TOP

Get or set the default URL#

The ClientConfig.default_url attribute contains server’s default URL (i.e. the one used when SwarmClient class is invoked without URL).

Example: create the ClientConfig object associated to the default configuration file and check the default URL:

# Import the ClientConfig (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig

# Create the ClientConfig object
default = ClientConfig()

default.default_url
'https://vires.services/ows'

If the default URL is not set, the attribute returns None.

Example: create a new configuration:

# Import the ClientConfig (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig

# Create new configuration
newcfg = ClientConfig('newfile.ini')

# Print default URL 
print(newcfg.default_url)
None

Set default URL to: https://vires.services/ows:

newcfg.default_url = 'https://vires.services/ows'

Get the updated result:

# Print default URL 
print(newcfg.default_url)
https://vires.services/ows

TOP

Set site configuration#

It is possible to set the configuration for a server identified by an URL with the Client.Config.set_site_config() method:

ClientConfig.set_site_config(url, **options)

Parameters:

  • url (str): server URL

  • **options (str): configuration options in the form: key=value (e.g.: token=’…’)

Example: create a new configuration, set default URL to: https://vires.services/ows and set the access token for this URL:

# Import the ClientConfig (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig

# Create new configuration
newcfg = ClientConfig('newfile.ini')

# Set default URL 
newcfg.default_url = 'https://vires.services/ows'

# Set the access token
newcfg.set_site_config(newcfg.default_url, token='mytokenstring')

TOP

Get site configuration#

It is possible to get the configuration for a server identified by an URL with the ClientConfig.get_site_config() method:

ClientConfig.get_site_config(url)

Parameters:

  • url (str): server URL

Example: create a new configuration, set default URL to: https://vires.services/ows, set the access token for this URL and get the configuration for https://vires.services/ows:

# Import the ClientConfig (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig

# Create new configuration
newcfg = ClientConfig('newfile.ini')

# Set default URL 
newcfg.default_url = 'https://vires.services/ows'

# Set the access token
newcfg.set_site_config(newcfg.default_url, token='mytokenstring')

# Get the configuration
newcfg.get_site_config('https://vires.services/ows')
{'token': 'mytokenstring'}

TOP

Save configuration#

The configuration stored in the ClientConfig object can be saved using the ClientConfig.save() method:

ClientConfig.save()

This method saves the configuration to the path specified during the ClientConfig creation. You can check this value via the ClientConfig.path attribute.

Example: create a new configuration, set default URL to: https://vires.services/ows, set the access token for this URL and save the configuration to file:

# Import the ClientConfig (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig

# Create new configuration
newcfg = ClientConfig('newfile.ini')

# Set default URL 
newcfg.default_url = 'https://vires.services/ows'

# Set the access token
newcfg.set_site_config(newcfg.default_url, token='mytokenstring')

# Save the configuration
newcfg.save()

Let’s have a look to the new configuration file:

!cat newfile.ini
[default]
url = https://vires.services/ows

[https://vires.services/ows]
token = mytokenstring
# delete newfile.ini
!rm newfile.ini

TOP

Upload data to the server - DataUpload#

You can upload your data to the server to view it in the VirES web interface. File format can be CDF or CSV and must be compliant to: ESA-VirES/VirES-Server.

Data can be uploaded using the DataUpload object:

class DataUpload(url, token, **kwargs)

Parameters:

  • url (str): server URL

  • token (str): access token

  • **kwargs (str): additional parameters (currently not used)

DataUpload object has the following attributes:

  • DataUpload.ids

and the following methods:

  • DataUpload.post()

  • DataUpload.get()

  • DataUpload.set_constant_parameters()

  • DataUpload.get_constant_parameters()

Example: create a DataUpload object for data upload to the default server. You can retrieve the default URL and the access token from the configuration, using the ClientConfig object:

# Import DataUpload object
from viresclient import DataUpload

# Import ClientConfig object (this step can be avoided if ClientConfig has been already imported)
from viresclient import ClientConfig

# Create ClientConfig object associated to the default configuration file: ~/.viresclient.ini
default = ClientConfig()

# Get default URL and access token from the configuration
url = default.default_url
token = default.get_site_config(url)['token']

# Create the DataUpload object:
du = DataUpload(url, token)

TOP

Upload a file to the server#

You can upload a file to the server using the DataUpload.post() method:

DataUpload.post(file, filename=None)

Parameters:

  • file (str): file to be uploaded

The method returns the info about the uploaded file as a dictionary.

Example: upload a product to the server:

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download 1 hour of MAGA_LR_1B data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B')
request.set_products(measurements=['F', 'B_NEC'])
data = request.get_between('2020-01-01T00:00:00', '2020-01-01T01:00:00')
data.to_file('out.cdf', overwrite=True)
Data written to out.cdf
# Import ClientConfig and DataUpload (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig, DataUpload

# Create ClientConfig object associated to the default configuration file: ~/.viresclient.ini
default = ClientConfig()

# Get default URL and access token from the configuration
url = default.default_url
token = default.get_site_config(url)['token']

# Create the DataUpload object:
du = DataUpload(url, token)

# Upload the file to the server to be visualized in the web client
info = du.post('out.cdf')

Check info about the uploaded file:

info
{'size': 243319,
 'fields': {'Timestamp': {'shape': [],
   'cdf_type': 31,
   'data_type': 'CDF_EPOCH'},
  'Latitude': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
  'Longitude': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
  'Radius': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
  'F': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
  'B_NEC': {'shape': [3], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'}},
 'source_fields': ['Timestamp',
  'Latitude',
  'Longitude',
  'Radius',
  'F',
  'B_NEC'],
 'missing_fields': {},
 'constant_fields': {},
 'identifier': '0f239d99-ceab-48a0-9870-97776eea2df3',
 'owner': 'ashley-testing',
 'is_valid': True,
 'created': '2024-01-24T17:45:05.377599Z',
 'start': '2020-01-01T00:00:00Z',
 'end': '2020-01-01T00:59:59Z',
 'filename': 'out.cdf',
 'data_file': 'out.cdf',
 'content_type': 'application/x-cdf',
 'checksum': 'ae9cf29627593d1c5f305fbeb92c9337'}
# Delete test file (if any)
!rm out.cdf

TOP

Get the identifier(s) of the uploaded file(s)#

You can obtain the identifiers of the uploaded files via the DataUpload.ids attribute as a list. Please note that currently the server accepts only one file at a time, thus the returned list will have length 1.

Example: upload a product to the server and get its identifier:

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download 1 hour of MAGA_LR_1B data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B')
request.set_products(measurements=['F', 'B_NEC'])
data = request.get_between('2020-01-01T00:00:00', '2020-01-01T01:00:00')
data.to_file('out.cdf', overwrite=True)
Data written to out.cdf
# Import ClientConfig and DataUpload (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig, DataUpload

# Create ClientConfig object associated to the default configuration file: ~/.viresclient.ini
default = ClientConfig()

# Get default URL and access token from the configuration
url = default.default_url
token = default.get_site_config(url)['token']

# Create the DataUpload object:
du = DataUpload(url, token)

# Upload the file to the server to be visualized in the web client
info = du.post('out.cdf')

Get id of the uploaded file:

du.ids
['8352c9b6-e8b1-4ba3-b192-cc43b7168d1f']
# Delete test file (if any)
!rm out.cdf

TOP

Get info about the uploaded file#

You can get the info of the uploaded file using the DataUpload.get() method:

DataUpload.get(identifier=None)

Parameters:

  • identifier (str, optional): identifier of the uploaded file obtained via DataUpload.ids attribute (see Get the identifier(s) of the uploaded file(s)) or from the info returned by the DataUpload.post() method (see Upload a file to the server). If not provided, returns the info af all the uploaded files as a list.

Example: upload a product to the server and get product’s info with DataUpload.get():

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download 1 hour of MAGA_LR_1B data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B')
request.set_products(measurements=['F', 'B_NEC'])
data = request.get_between('2020-01-01T00:00:00', '2020-01-01T01:00:00')
data.to_file('out.cdf', overwrite=True)
Data written to out.cdf
# Import ClientConfig and DataUpload (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig, DataUpload

# Create ClientConfig object associated to the default configuration file: ~/.viresclient.ini
default = ClientConfig()

# Get default URL and access token from the configuration
url = default.default_url
token = default.get_site_config(url)['token']

# Create the DataUpload object:
du = DataUpload(url, token)

# Upload the file to the server to be visualized in the web client
info = du.post('out.cdf')

Get info about the uploaded file:

du.get(du.ids[0])
{'size': 243319,
 'fields': {'Timestamp': {'shape': [],
   'cdf_type': 31,
   'data_type': 'CDF_EPOCH'},
  'Latitude': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
  'Longitude': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
  'Radius': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
  'F': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
  'B_NEC': {'shape': [3], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'}},
 'source_fields': ['Timestamp',
  'Latitude',
  'Longitude',
  'Radius',
  'F',
  'B_NEC'],
 'missing_fields': {},
 'constant_fields': {},
 'identifier': '3c153428-a61a-44e0-86a9-d34e6d07d8de',
 'owner': 'ashley-testing',
 'is_valid': True,
 'created': '2024-01-24T17:45:15.042964Z',
 'start': '2020-01-01T00:00:00Z',
 'end': '2020-01-01T00:59:59Z',
 'filename': 'out.cdf',
 'data_file': 'out.cdf',
 'content_type': 'application/x-cdf',
 'checksum': '2c4e60b2026567789c898cf63f51cece'}

If the identifier is not provided, you will get info about all the files as a list:

du.get()
[{'size': 243319,
  'fields': {'Timestamp': {'shape': [],
    'cdf_type': 31,
    'data_type': 'CDF_EPOCH'},
   'Latitude': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
   'Longitude': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
   'Radius': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
   'F': {'shape': [], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'},
   'B_NEC': {'shape': [3], 'cdf_type': 45, 'data_type': 'CDF_DOUBLE'}},
  'source_fields': ['Timestamp',
   'Latitude',
   'Longitude',
   'Radius',
   'F',
   'B_NEC'],
  'missing_fields': {},
  'constant_fields': {},
  'identifier': '3c153428-a61a-44e0-86a9-d34e6d07d8de',
  'owner': 'ashley-testing',
  'is_valid': True,
  'created': '2024-01-24T17:45:15.042964Z',
  'start': '2020-01-01T00:00:00Z',
  'end': '2020-01-01T00:59:59Z',
  'filename': 'out.cdf',
  'data_file': 'out.cdf',
  'content_type': 'application/x-cdf',
  'checksum': '2c4e60b2026567789c898cf63f51cece'}]
# Delete test file (if any)
!rm out.cdf

TOP

Set constant parameters to the uploaded file#

It is possible to set constant parameters to the uploaded file using the DataUpload.set_constant_parameters() method:

DataUpload.set_constant_parameters(identifier, parameters, replace=False)

Parameters:

  • identifier (str): file identifier.

  • parameters (dict): constant parameters provided as a dictionary

  • replace (bool, optional): if set to True, all the parameters will be replaced by the new parameters, otherwise the new parameters will update the existing ones (default behaviour).

Example: upload a product to the server and set constant parameters to the uploaded file:

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download 1 hour of MAGA_LR_1B data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B')
request.set_products(measurements=['F', 'B_NEC'])
data = request.get_between('2020-01-01T00:00:00', '2020-01-01T01:00:00')
data.to_file('out.cdf', overwrite=True)
Data written to out.cdf
# Import ClientConfig and DataUpload (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig, DataUpload

# Create ClientConfig object associated to the default configuration file: ~/.viresclient.ini
default = ClientConfig()

# Get default URL and access token from the configuration
url = default.default_url
token = default.get_site_config(url)['token']

# Create the DataUpload object:
du = DataUpload(url, token)

# Upload the file to the server to be visualized in the web client
info = du.post('out.cdf')

Assign constant parameters: \(param1 = 12345\) and \(param2 = 34567\):

du.set_constant_parameters(du.ids[0], {'param1': 12345, 'param2': 34567})
{'param1': 12345, 'param2': 34567}

If you want to set param1 to a new value you can update the existing set of parameters:

du.set_constant_parameters(du.ids[0], {'param1': 1})
{'param1': 1, 'param2': 34567}

or replace the entire set of parameters:

du.set_constant_parameters(du.ids[0], {'param1': 1}, replace=True)
{'param1': 1}

Note that param2 has been removed.

# Delete test file (if any)
!rm out.cdf

TOP

Get constant parameters applied to the uploaded file#

It is possible to get the list of constant parameters applied to the uploaded file using the DataUpload.get_constant_parameters() method:

DataUpload.get_constant_parameters(identifier)

Parameters:

  • identifier (str): file identifier.

Example: upload a product to the server and get constant parameters applied to the uploaded file:

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download 1 hour of MAGA_LR_1B data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B')
request.set_products(measurements=['F', 'B_NEC'])
data = request.get_between('2020-01-01T00:00:00', '2020-01-01T01:00:00')
data.to_file('out.cdf', overwrite=True)
Data written to out.cdf
# Import ClientConfig and DataUpload (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig, DataUpload

# Create ClientConfig object associated to the default configuration file: ~/.viresclient.ini
default = ClientConfig()

# Get default URL and access token from the configuration
url = default.default_url
token = default.get_site_config(url)['token']

# Create the DataUpload object:
du = DataUpload(url, token)

# Upload the file to the server to be visualized in the web client
info = du.post('out.cdf')

Assign constant parameters: \(param1 = 12345\) and \(param2 = 34567\):

du.set_constant_parameters(du.ids[0], {'param1': 12345, 'param2': 34567})
{'param1': 12345, 'param2': 34567}

Get the list of constant parameters:

du.get_constant_parameters(du.ids[0])
{'param1': 12345, 'param2': 34567}
# Delete test file (if any)
!rm out.cdf

TOP

Delete a specific uploaded file#

You can delete a specific uploaded file using the DataUpload.delete() method:

DataUpload.delete(identifier)

Parameters:

  • identifier (str): identifier of the uploaded file obtained via DataUpload.ids attribute (see Get the identifier(s) of the uploaded file(s)) or from the info returned by the DataUpload.post() method (see Upload a file to the server). If not provided, returns the info af all the uploaded files as a list.

Example: upload a product to the server and delete it with DataUpload.delete():

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download 1 hour of MAGA_LR_1B data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B')
request.set_products(measurements=['F', 'B_NEC'])
data = request.get_between('2020-01-01T00:00:00', '2020-01-01T01:00:00')
data.to_file('out.cdf', overwrite=True)
Data written to out.cdf
# Import ClientConfig and DataUpload (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig, DataUpload

# Create ClientConfig object associated to the default configuration file: ~/.viresclient.ini
default = ClientConfig()

# Get default URL and access token from the configuration
url = default.default_url
token = default.get_site_config(url)['token']

# Create the DataUpload object:
du = DataUpload(url, token)

# Upload the file to the server to be visualized in the web client
info = du.post('out.cdf')

Delete the uploaded product:

du.delete(du.ids[0])

du.ids
[]
# Delete test file (if any)
!rm out.cdf

TOP

Delete the uploaded files#

You can delete all the uploaded files using the DataUpload.clear() method:

DataUpload.clear()

Example: upload a product to the server and delete it with DataUpload.clear():

# Import SwarmClient (this step can be omitted if already executed in the previous examples)
from viresclient import SwarmRequest

# Download 1 hour of MAGA_LR_1B data
request = SwarmRequest()
request.set_collection('SW_OPER_MAGA_LR_1B')
request.set_products(measurements=['F', 'B_NEC'])
data = request.get_between('2020-01-01T00:00:00', '2020-01-01T01:00:00')
data.to_file('out.cdf', overwrite=True)
Data written to out.cdf
# Import ClientConfig and DataUpload (this step can be omitted if already executed in the previous examples)
from viresclient import ClientConfig, DataUpload

# Create ClientConfig object associated to the default configuration file: ~/.viresclient.ini
default = ClientConfig()

# Get default URL and access token from the configuration
url = default.default_url
token = default.get_site_config(url)['token']

# Create the DataUpload object:
du = DataUpload(url, token)

# Upload the file to the server to be visualized in the web client
info = du.post('out.cdf')

Delete the uploaded product(s):

du.clear()

du.ids
[]