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
   SW_FAST_FACATMS_2F
   SW_FAST_FACBTMS_2F
   SW_FAST_FACCTMS_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_CHAMP
   CH_ME_MAG_LR_3
https://doi.org/10.5880/GFZ.2.3.2019.004

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_GFO_ML
   GF1_MAG_ACAL_CORR_ML
   GF2_MAG_ACAL_CORR_ML
https://doi.org/10.5880/GFZ.2.3.2023.001

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...

DNS_POD
   SW_OPER_DNSAPOD_2_
   SW_OPER_DNSBPOD_2_
   SW_OPER_DNSCPOD_2_
https://swarmhandbook.earth.esa.int/catalogue/SW_DNSxPOD_2_

DNS_ACC
   SW_OPER_DNSAACC_2_
   SW_OPER_DNSBACC_2_
   SW_OPER_DNSCACC_2_
https://swarmhandbook.earth.esa.int/catalogue/SW_DNSxACC_2_

DNS_ACC_CHAMP
   CH_OPER_DNS_ACC_2_
https://swarmhandbook.earth.esa.int/catalogue/CH_DNS_ACC_2_

DNS_ACC_GRACE
   GR_OPER_DNS1ACC_2_
   GR_OPER_DNS2ACC_2_
https://swarmhandbook.earth.esa.int/catalogue/GR_DNSxACC_2_

DNS_ACC_GFO
   GF_OPER_DNS1ACC_2_
https://swarmhandbook.earth.esa.int/catalogue/GF_DNSxACC_2_

WND_ACC_CHAMP
   CH_OPER_WND_ACC_2_
https://swarmhandbook.earth.esa.int/catalogue/CH_WND_ACC_2_

WND_ACC_GRACE
   GR_OPER_WND1ACC_2_
   GR_OPER_WND2ACC_2_
https://swarmhandbook.earth.esa.int/catalogue/GR_WNDxACC_2_

WND_ACC_GFO
   GF_OPER_WND1ACC_2_
https://swarmhandbook.earth.esa.int/catalogue/GF_WNDxACC_2_

MM_CON_EPH_2_:crossover
   MM_OPER_CON_EPH_2_:crossover
No reference...

MM_CON_EPH_2_:plane_alignment
   MM_OPER_CON_EPH_2_:plane_alignment
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',
  'SW_FAST_FACATMS_2F',
  'SW_FAST_FACBTMS_2F',
  'SW_FAST_FACCTMS_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_CHAMP': ['CH_ME_MAG_LR_3'],
 '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_GFO_ML': ['GF1_MAG_ACAL_CORR_ML', 'GF2_MAG_ACAL_CORR_ML'],
 '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'],
 'DNS_POD': ['SW_OPER_DNSAPOD_2_', 'SW_OPER_DNSBPOD_2_', 'SW_OPER_DNSCPOD_2_'],
 'DNS_ACC': ['SW_OPER_DNSAACC_2_', 'SW_OPER_DNSBACC_2_', 'SW_OPER_DNSCACC_2_'],
 'DNS_ACC_CHAMP': ['CH_OPER_DNS_ACC_2_'],
 'DNS_ACC_GRACE': ['GR_OPER_DNS1ACC_2_', 'GR_OPER_DNS2ACC_2_'],
 'DNS_ACC_GFO': ['GF_OPER_DNS1ACC_2_'],
 'WND_ACC_CHAMP': ['CH_OPER_WND_ACC_2_'],
 'WND_ACC_GRACE': ['GR_OPER_WND1ACC_2_', 'GR_OPER_WND2ACC_2_'],
 'WND_ACC_GFO': ['GF_OPER_WND1ACC_2_'],
 'MM_CON_EPH_2_:crossover': ['MM_OPER_CON_EPH_2_:crossover'],
 'MM_CON_EPH_2_:plane_alignment': ['MM_OPER_CON_EPH_2_:plane_alignment']}

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_CHAMP': ['F',
  'B_VFM',
  'B_NEC',
  'Flags_Position',
  'Flags_B',
  'Flags_q',
  'Mode_q',
  'q_ICRF_CRF'],
 '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_GFO_ML': ['F',
  'B_MAG',
  'B_NEC',
  'q_NEC_FGM',
  'B_FLAG',
  'KP_DST_FLAG',
  'Latitude_QD',
  'Longitude_QD'],
 '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',
  'MAGNETIC_ACTIVITY_FLAG',
  'NaN_FLAG',
  'Latitude_QD',
  'Longitude_QD'],
 'MOD_SC': [],
 'DNS_POD': ['Height_GD',
  'Latitude_GD',
  'Longitude_GD',
  'Height_GD',
  'local_solar_time',
  'density',
  'density_orbitmean',
  'validity_flag'],
 'DNS_ACC': ['Height_GD',
  'Latitude_GD',
  'Longitude_GD',
  'Height_GD',
  'density',
  'local_solar_time'],
 'DNS_ACC_CHAMP': ['Height_GD',
  'Latitude_GD',
  'Longitude_GD',
  'density',
  'density_orbitmean',
  'local_solar_time',
  'validity_flag',
  'validity_flag_orbitmean'],
 'DNS_ACC_GRACE': ['Height_GD',
  'Latitude_GD',
  'Longitude_GD',
  'density',
  'density_orbitmean',
  'local_solar_time',
  'validity_flag',
  'validity_flag_orbitmean'],
 'DNS_ACC_GFO': ['Height_GD',
  'Latitude_GD',
  'Longitude_GD',
  'density',
  'density_orbitmean',
  'local_solar_time',
  'validity_flag',
  'validity_flag_orbitmean'],
 'WND_ACC_CHAMP': ['Height_GD',
  'Latitude_GD',
  'Longitude_GD',
  'crosswind',
  'crosswind_direction',
  'local_solar_time',
  'validity_flag'],
 'WND_ACC_GRACE': ['Height_GD',
  'Latitude_GD',
  'Longitude_GD',
  'crosswind',
  'crosswind_direction',
  'local_solar_time',
  'validity_flag'],
 'WND_ACC_GFO': ['Height_GD',
  'Latitude_GD',
  'Longitude_GD',
  'crosswind',
  'crosswind_direction',
  'local_solar_time',
  'validity_flag'],
 'MM_CON_EPH_2_:crossover': ['time_1',
  'time_2',
  'time_difference',
  'satellite_1',
  'satellite_2',
  'latitude',
  'longitude',
  'altitude_1',
  'altitude_2',
  'magnetic_latitude',
  'magnetic_longitude',
  'local_solar_time_1',
  'local_solar_time_2'],
 'MM_CON_EPH_2_:plane_alignment': ['time',
  'altitude_1',
  'altitude_2',
  'ltan_1',
  'ltan_2',
  'ltan_rate_1',
  'ltan_rate_2',
  'satellite_1',
  'satellite_2']}

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',
 'F107_avg81d',
 'F107_avg81d_count',
 '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_0105

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-09-20T11: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_20240807T235959_0718
  SW_OPER_MCO_SHA_2X_20240808T000000_20250131T235959_0718
  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_20240920T113000_0717

CHAOS-Core = 'CHAOS-Core'(max_degree=20,min_degree=1)
  START: 1997-02-07T05:23:17.067838Z
  END:   2025-02-01T17:28:42.303362Z
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_20240807T235959_0718
  SW_OPER_MCO_SHA_2X_20240808T000000_20250131T235959_0718

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-09-20T11: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_20240920T113000_0717

CHAOS-MMA-Primary = 'CHAOS-MMA-Primary'(max_degree=2,min_degree=1)
  START: 2000-01-01T00:00:00Z
  END:   2024-09-20T11: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_20240920T113000_0717

CHAOS-MMA-Secondary = 'CHAOS-MMA-Secondary'(max_degree=2,min_degree=1)
  START: 2000-01-01T00:00:00Z
  END:   2024-09-20T11: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_20240920T113000_0717

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-12-01T00:16:33.599998Z
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_20231201T000000_1001

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:   2025-02-01T17:28:42.303362Z
DESCRIPTION:
Alias for 'CHAOS-Core'
SOURCES:
  SW_OPER_MCO_SHA_2X_19970101T000000_20240807T235959_0718
  SW_OPER_MCO_SHA_2X_20240808T000000_20250131T235959_0718

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_1001

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_1001

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_1001

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_1001

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=3,min_degree=1) + 'MMA_SHA_2C-Secondary'(max_degree=3,min_degree=1)
  START: 2013-11-25T03:00:00Z
  END:   2023-11-30T21:00:00Z
DESCRIPTION:
Alias for 'MMA_SHA_2C-Primary' + 'MMA_SHA_2C-Secondary'
SOURCES:
  SW_OPER_MMA_SHA_2C_20131125T000000_20231130T235959_1001

MMA_SHA_2C-Primary = 'MMA_SHA_2C-Primary'(max_degree=3,min_degree=1)
  START: 2013-11-25T03:00:00Z
  END:   2023-11-30T21: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_20231130T235959_1001

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

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-09-15T21: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_20240915T223000_0108

MMA_SHA_2F-Primary = 'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-09-15T21: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_20240915T223000_0108

MMA_SHA_2F-Secondary = 'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-09-15T21: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_20240915T223000_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=3,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:   2023-11-30T21: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_20231201T000000_1001
  SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_1001
  SW_OPER_MLI_SHA_2C_00000000T000000_99999999T999999_1001
  SW_OPER_MMA_SHA_2C_20131125T000000_20231130T235959_1001

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-09-15T21: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_20240915T223000_0108

MMA_SHA_2F-Primary = 'MMA_SHA_2F-Primary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-09-15T21: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_20240915T223000_0108

MMA_SHA_2F-Secondary = 'MMA_SHA_2F-Secondary'(max_degree=1,min_degree=1)
  START: 2013-11-25T11:15:00Z
  END:   2024-09-15T21: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_20240915T223000_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-09-15T21: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_20240915T223000_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-09-15T21: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_20240915T223000_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-09-15T21: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_20240915T223000_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_0105']},
 '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-09-20T11:30:00Z'},
  'sources': ['CHAOS-7_static.shc',
   'SW_OPER_MCO_SHA_2X_19970101T000000_20240807T235959_0718',
   'SW_OPER_MCO_SHA_2X_20240808T000000_20250131T235959_0718',
   '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_20240920T113000_0717']},
 'CHAOS-Core': {'expression': "'CHAOS-Core'(max_degree=20,min_degree=1)",
  'validity': {'start': '1997-02-07T05:23:17.067838Z',
   'end': '2025-02-01T17:28:42.303362Z'},
  'sources': ['SW_OPER_MCO_SHA_2X_19970101T000000_20240807T235959_0718',
   'SW_OPER_MCO_SHA_2X_20240808T000000_20250131T235959_0718']},
 '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-09-20T11: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_20240920T113000_0717']},
 'CHAOS-MMA-Primary': {'expression': "'CHAOS-MMA-Primary'(max_degree=2,min_degree=1)",
  'validity': {'start': '2000-01-01T00:00:00Z', 'end': '2024-09-20T11: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_20240920T113000_0717']},
 'CHAOS-MMA-Secondary': {'expression': "'CHAOS-MMA-Secondary'(max_degree=2,min_degree=1)",
  'validity': {'start': '2000-01-01T00:00:00Z', 'end': '2024-09-20T11: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_20240920T113000_0717']},
 '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-12-01T00:16:33.599998Z'},
  'sources': ['SW_OPER_MCO_SHA_2C_20131125T000000_20231201T000000_1001']},
 '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': '2025-02-01T17:28:42.303362Z'},
  'sources': ['SW_OPER_MCO_SHA_2X_19970101T000000_20240807T235959_0718',
   'SW_OPER_MCO_SHA_2X_20240808T000000_20250131T235959_0718']},
 '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_1001']},
 '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_1001']},
 '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_1001']},
 '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_1001']},
 '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=3,min_degree=1) + 'MMA_SHA_2C-Secondary'(max_degree=3,min_degree=1)",
  'validity': {'start': '2013-11-25T03:00:00Z', 'end': '2023-11-30T21:00:00Z'},
  'sources': ['SW_OPER_MMA_SHA_2C_20131125T000000_20231130T235959_1001']},
 'MMA_SHA_2C-Primary': {'expression': "'MMA_SHA_2C-Primary'(max_degree=3,min_degree=1)",
  'validity': {'start': '2013-11-25T03:00:00Z', 'end': '2023-11-30T21:00:00Z'},
  'sources': ['SW_OPER_MMA_SHA_2C_20131125T000000_20231130T235959_1001']},
 'MMA_SHA_2C-Secondary': {'expression': "'MMA_SHA_2C-Secondary'(max_degree=3,min_degree=1)",
  'validity': {'start': '2013-11-25T03:00:00Z', 'end': '2023-11-30T21:00:00Z'},
  'sources': ['SW_OPER_MMA_SHA_2C_20131125T000000_20231130T235959_1001']},
 '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-09-15T21: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_20240915T223000_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-09-15T21: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_20240915T223000_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-09-15T21: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_20240915T223000_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=3,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': '2023-11-30T21:00:00Z'},
  'sources': ['SW_OPER_MCO_SHA_2C_20131125T000000_20231201T000000_1001',
   'SW_OPER_MIO_SHA_2C_00000000T000000_99999999T999999_1001',
   'SW_OPER_MLI_SHA_2C_00000000T000000_99999999T999999_1001',
   'SW_OPER_MMA_SHA_2C_20131125T000000_20231130T235959_1001']},
 '_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_1001']},
 '_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_1001']},
 '_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_1001']},
 '_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': '2025-02-01T17:28:42.303362Z'},
  'sources': ['SW_OPER_MCO_SHA_2X_19970101T000000_20240807T235959_0718',
   'SW_OPER_MCO_SHA_2X_20240808T000000_20250131T235959_0718']},
 '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': '2025-02-01T17:28:42.303362Z'},
  'sources': ['SW_OPER_MCO_SHA_2X_19970101T000000_20240807T235959_0718',
   'SW_OPER_MCO_SHA_2X_20240808T000000_20250131T235959_0718']},
 {'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-09-20 09:45:42--  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             6%[>                   ]  44.22K   143KB/s               
LCS-1.shc            32%[=====>              ] 211.56K   342KB/s               
LCS-1.shc           100%[===================>] 642.25K   816KB/s    in 0.8s    

2024-09-20 09:45:44 (816 KB/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:2208: 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:2208: 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:2208: 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:2077: 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 0x7fa81bb26090>

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 0x7fa81ba05a10>

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 0x7fa81b9fe3d0>

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

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

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_20240921T233038_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_MAGA_LR_1B_20190930T000000_20190930T235959_0605_MDR_MAG_LR',
 'SW_OPER_MAGA_LR_1B_20191001T000000_20191001T235959_0605_MDR_MAG_LR',
 'SW_OPER_MCO_SHA_2X_19970101T000000_20240807T235959_0718']

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 0x7fa81ba5db50>]

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()
OrbitNumber Longitude Spacecraft F_CHAOS Latitude B_NEC_CHAOS F Radius B_NEC Ne
Timestamp
2019-10-01 00:00:00 32904 37.641385 A 26240.546521 -33.130184 [11045.92483728217, -6220.994714451381, -22975... 26245.7441 6820061.62 [11030.761900000001, -6220.7565, -22988.4703] 108830.9
2019-10-01 00:00:10 32904 37.642219 A 26276.139716 -33.771114 [10925.465932998422, -6344.502837588694, -2303... 26281.6953 6820113.70 [10910.869400000001, -6343.9752, -23053.021200... 116231.7
2019-10-01 00:00:20 32904 37.643695 A 26316.140516 -34.412011 [10812.431477104554, -6467.061260708561, -2310... 26322.0452 6820164.75 [10798.136700000001, -6466.8217, -23117.9093] 116226.5
2019-10-01 00:00:30 32904 37.645838 A 26360.723680 -35.052873 [10706.642191415218, -6588.68489105867, -23169... 26366.9577 6820214.81 [10692.7317, -6588.5995, -23183.578700000002] 120598.5
2019-10-01 00:00:40 32904 37.648675 A 26410.061445 -35.693700 [10607.899773452787, -6709.366872541279, -2323... 26416.6195 6820263.86 [10594.236700000001, -6709.1323, -23250.6987] 129792.6

Setting expand=True:

df = data.as_dataframe(expand=True)

each vector component is in a separate column:

df.head()
OrbitNumber Longitude F_CHAOS Spacecraft Latitude F 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 32904 37.641385 26240.546521 A -33.130184 26245.7441 6820061.62 108830.9 11045.924837 -6220.994714 -22975.052795 11030.7619 -6220.7565 -22988.4703
2019-10-01 00:00:10 32904 37.642219 26276.139716 A -33.771114 26281.6953 6820113.70 116231.7 10925.465933 -6344.502838 -23039.466059 10910.8694 -6343.9752 -23053.0212
2019-10-01 00:00:20 32904 37.643695 26316.140516 A -34.412011 26322.0452 6820164.75 116226.5 10812.431477 -6467.061261 -23104.278735 10798.1367 -6466.8217 -23117.9093
2019-10-01 00:00:30 32904 37.645838 26360.723680 A -35.052873 26366.9577 6820214.81 120598.5 10706.642191 -6588.684891 -23169.911466 10692.7317 -6588.5995 -23183.5787
2019-10-01 00:00:40 32904 37.648675 26410.061445 A -35.693700 26416.6195 6820263.86 129792.6 10607.899773 -6709.366873 -23236.785580 10594.2367 -6709.1323 -23250.6987

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'
    OrbitNumber  (Timestamp) int32 32904 32904 32904 32904 ... 32905 32905 32905
    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
    B_NEC_CHAOS  (Timestamp, NEC) float64 1.105e+04 -6.221e+03 ... 4.744e+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
    Radius       (Timestamp) float64 6.82e+06 6.82e+06 ... 6.803e+06 6.803e+06
    B_NEC        (Timestamp, NEC) float64 1.103e+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 0x7fa81ba05810>,
 <viresclient._data_handling.ReturnedDataFile at 0x7fa84bdbe6d0>]
# 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 0x7fa84bdb0e50>]

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

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

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 0x7fa84bdd2ad0>]
# 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': '9336b6da-d18d-44d1-a511-60ec011200ab',
 'owner': 'ashley-testing',
 'is_valid': True,
 'created': '2024-09-20T09:48:07.495885Z',
 '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': 'c0c7de9cee612dc21003081d5406944b'}
# 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
['834e5294-947c-4bca-8a0e-32e3e25a0dc8']
# 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': '7bf630f9-71eb-468f-b9c4-613f93119174',
 'owner': 'ashley-testing',
 'is_valid': True,
 'created': '2024-09-20T09:48:22.163847Z',
 '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': '1d93d80f43b5fc967b4dd07caa329376'}

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': '7bf630f9-71eb-468f-b9c4-613f93119174',
  'owner': 'ashley-testing',
  'is_valid': True,
  'created': '2024-09-20T09:48:22.163847Z',
  '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': '1d93d80f43b5fc967b4dd07caa329376'}]
# 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
[]