" submitted to Earth, Planets and Space, see also: \n",
" https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
...
...
%% Cell type:markdown id: tags:
Isoline for 1 sigma in polar wander plot
%% Cell type:code id: tags:
``` python
# Imports
importsys
importos
# relative import
sys.path.append(os.path.abspath('')+'/../')
importnumpyasnp
importpandasaspd
frommatplotlibimportpyplotasplt
fromscipy.statsimportuniform,gamma
importpyfield
fromcorbass.utilsimportload,nez2dif
```
%% Cell type:code id: tags:
``` python
# seed for reproducability
np.random.seed(161)
```
%% Cell type:markdown id: tags:
# Generate synthetic data for tests
This notebook serves the purpose of generating synthetic data for testing the `CORBASS` algorithm. We therefore generate data from a given set of Gauss coefficients and add synthetic errors from the Fisher-von Mises and the gamma distribution.
%% Cell type:code id: tags:
``` python
# some basic parameters
# the name of the output file
out='../dat/synth_data_clean_complete.csv'
# switch for using locations and incompleteness structure from the example data file
real_locs=False
# the number of records to be generated, is only used if real_locs is False
n_points=412
# the fraction of incomplete records, works as a switch if real_locs is False
r_inc=0.
# switch for corrupting the data by noise
noise=False
# the error levels to be stored
ddec=4.5
dinc=4.5
dint=8250
# the average concentration parameter from GEOMAGIA for the interval [750, today] is 650
kappa=650
header=f"# This file was produced using the notebook Gen_Data.ipynb with the following parameters:\n" \
We draw some samples and plot the result, to eye-check whether the procedure works:
%% Cell type:code id: tags:
``` python
SF=sample_Fisher(1000,mu=(-1,0,0),kappa=10);
fig,ax=plt.subplots(1,1,figsize=(10,5))
D=np.arctan2(SF[1],SF[0])
I=np.arctan2(SF[2],np.sqrt(SF[0]**2+SF[1]**2))
ax.set_aspect(1)
ax.set_xlim((-np.pi,np.pi));
ax.set_xlabel('D [rad.]')
ax.set_ylim((-np.pi/2.,np.pi/2.));
ax.set_ylabel('I [rad.]')
ax.scatter(D,I,alpha=0.4);
```
%% Output
%% Cell type:markdown id: tags:
## Generate synthetic data
We first need a set of coefficients for the field. At the time of writing this, IGRF-13 \[1\] had just been released and we take the reported coefficients as a reference model. You can get it [here](https://www.ngdc.noaa.gov/IAGA/vmod/coeffs/igrf13coeffs.txt). Place the file in the `/dat/` folder.