Usage

Calculation of IBP Index

To calculate the IBP index use ibpmodel.ibpforward.calculateIBPindex() function. It returns a pandas.DataFrame:

>>> from ibpmodel import calculateIBPindex
>>> calculateIBPindex(day_month=15, longitude=0, local_time=20.9, f107=150)
   Doy  Month  Lon    LT  F10.7     IBP
0   15      1    0  20.9    150  0.4031
>>> from ibpmodel import calculateIBPindex
>>> calculateIBPindex(day_month=['Jan','Feb','Mar'], local_time=22)
     Doy  Month  Lon  LT  F10.7     IBP
0     15      1 -180  22    150  0.0634
1     15      1 -175  22    150  0.0646
2     15      1 -170  22    150  0.0659
3     15      1 -165  22    150  0.0672
4     15      1 -160  22    150  0.0707
..   ...    ...  ...  ..    ...     ...
211   74      3  155  22    150  0.2408
212   74      3  160  22    150  0.2437
213   74      3  165  22    150  0.2488
214   74      3  170  22    150  0.2539
215   74      3  175  22    150  0.2573

[216 rows x 6 columns]
>>> from ibpmodel import calculateIBPindex
>>> calculateIBPindex(day_month=[1,15,31], longitude=[-170,175,170], local_time=0, f107=120)
   Doy  Month  Lon  LT  F10.7     IBP
0    1      1 -170   0    120  0.0338
1    1      1  175   0    120  0.0311
2    1      1  170   0    120  0.0316
3   15      1 -170   0    120  0.0374
4   15      1  175   0    120  0.0345
5   15      1  170   0    120  0.0350
6   31      1 -170   0    120  0.0468
7   31      1  175   0    120  0.0432
8   31      1  170   0    120  0.0438

Read coefficient file

You can load the coefficient file. ibpmodel.ibpcalc.read_model_file():

>>> from ibpmodel import read_model_file
>>> c = read_model_file()
>>> c.keys()
dict_keys(['Parameters', 'Intensity', 'Monthly_LT_Shift', 'Density_Estimators', 'Density_Estimator_Lons'])
>>> 
>>> c['Intensity']
array([ -20.00344964,   -9.0176684 ,   72.07899169,   10.84847818,
       -153.44073427])

Plotting of the probability

There are two functions to plot IBP index. function ibpmodel.ibpforward.plotIBPindex() and ibpmodel.ibpforward.plotButterflyData(). By default, the plot is displayed immediately. If you want to make changes or additions, the parameter getFig must be set equal to True. Then you get matplat.axis as return value:

>>> import ibpmodel as ibp
>>> ibp.plotIBPindex(doy=349)
Contour plot of the IBP index for the given day
>>> ibp.plotButterflyData(f107=150)
Contour plot of result from function ButterflyData()
>>> import ibpmodel as ibp
>>> import matplotlib.pyplot as plt
>>> doys = [349, 15]
>>> fig, axes = plt.subplots(len(doys),1, layout='constrained',figsize=(9, 7))
>>> for d, ax in zip(doys, axes):
...     ax, scalarmap = ibp.plotIBPindex(d, ax=ax)
>>> ibp.ibpforward.setcolorbar(scalarmap, fig, axes, fraction=0.05)
>>> plt.show()
Subplot of IBP index