Skip to content

Backend: Creating IAGA INTERMAGNET BLV files

Roman Leonhardt edited this page Jan 29, 2019 · 4 revisions

Introduction to create IAGA/INTERMAGNET BLV files:

Prerequisites:

  1. you already have analyzed all Di measurements and have a MagPy BLV_code_xxx.txt file
  2. you already have definite one minute data for the year TODO: Daily means of delta F need to be added into the BLV files Yearly means need to be added to the header as well Replace "WIC" with your stationcode, paths need to be changed as well

Start MagPy backend on Windows Got to Menu->Applications->MagPy->Python Then run the python interpretor:

Import all basic magpy packages

from magpy.stream import *

read all definitive one minute data of one year and caluculate means

data = read("c:\my\path\wic2018*")

eventually convert your data to x,y,z

data = data.hdz2xyz()

IMPORTANT: if delta F is already contained then skip the next step else calculate delta F from vector and independent F.

data = data.delta_f()

Get daily mean values:

dailymean = data.dailymeans(keys=['x','y','z','df'], keepposition=True)

Convert data to hdz

data = data.xyz2hdz()

Calculate yearly means (from original minute data)

meanh = data.mean('x') # 'x' column contains h values now meanf = data.mean('f')

Read you already existing BLV_code file

absresult = read("c:\path\to\BLV_code_xxx.txt")

Add IAGA station code:

absresult.header['StationID'] = 'WIC'

Export the IAGA BLV file with all required header information and appropriate daily delta F values

absresult.write("c:\you\result\path", coverage='all',format_type='BLV', deltaF=0.0, diff=dailymean, year='2018', meanh=meanh, meanf=meanf, absinfo=final.header.get('DataAbsInfo'))