Skip to content

Commit

Permalink
Added package precompilation
Browse files Browse the repository at this point in the history
  • Loading branch information
MicheleCeresoli committed Jan 9, 2024
1 parent a633fe5 commit 3d0433d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/IERSConventions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ module IERSConventions
# Rotation functions
include("rotations.jl")

# Package precompilation
include("precompile.jl")

function __init__()
if !Tempo.has_timescale(TIMESCALES, Tempo.timescale_id(UT1))
Tempo.add_timescale!(TIMESCALES, UT1, offset_tt2ut1; parent=TT)
Expand Down
49 changes: 49 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

PrecompileTools.@setup_workload begin

PrecompileTools.@compile_workload begin

# Here we manually turn the EOP initialisation to true so
# that we are able to call all the routines. It doesn't really
# matter what values are returned as long as the functions do not throw errors.

IERS_EOP.init = true

t = 0.0

# Just calling this functions should be enough to pre-compile everything
# else that downstreams from those.
for m in (iers2010a, iers2010b, CPNc, CPNd, iers2003a, iers2003b, iers1996)

# Precompile all rotations!
iers_rot3_gcrf_to_mod(t, m)
iers_rot3_gcrf_to_tod(t, m)
iers_rot3_gcrf_to_gtod(t, m)
iers_rot3_gcrf_to_pef(t, m)
iers_rot3_itrf_to_mod(t, m)
iers_rot3_itrf_to_tod(t, m)
iers_rot3_itrf_to_gtod(t, m)
iers_rot3_itrf_to_pef(t, m)
iers_rot3_gcrf_to_cirf(t, m)
iers_rot3_gcrf_to_itrf(t, m)
iers_rot3_gcrf_to_tirf(t, m)
iers_rot3_itrf_to_cirf(t, m)
iers_rot3_itrf_to_tirf(t, m)

iers_bias(m, t)
iers_precession(m, t)

iers_nutation(m, t)
iers_nutation(m, t, t, t)

precession_angles_rot3(m, t)
precession_angles_rot4(m, t)

end

# We make sure that EOP are unloaded
eop_unload_data!()

end

end

0 comments on commit 3d0433d

Please sign in to comment.