Skip to content

Commit

Permalink
🐛 Fix igrf12 when date >= 2020
Browse files Browse the repository at this point in the history
  • Loading branch information
ronisbr committed Aug 16, 2018
1 parent c0fd113 commit 6899d73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/earth/geomagnetic_field_models/igrf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function igrf12(date::Number,
# Compute the epoch that will be used to obtain the coefficients. This is
# necessary because the IGRF provides coefficients every 5 years. Between
# two epochs, those coefficients must be interpolated.
idx = floor(Int, (date-1900)*0.2+1)
idx = (date < 2020) ? floor(Int, (date-1900)*0.2+1) : 24
epoch = 1900 + (idx-1)*5

# Compute the fraction of time from the epoch of the coefficient selected by
Expand Down

0 comments on commit 6899d73

Please sign in to comment.