diff --git a/.DS_Store b/.DS_Store index f27572d..4611e70 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/pyatmos/.DS_Store b/pyatmos/.DS_Store index e8941bc..6fc0733 100644 Binary files a/pyatmos/.DS_Store and b/pyatmos/.DS_Store differ diff --git a/pyatmos/__init__.py b/pyatmos/__init__.py index 45a9379..83f49a7 100644 --- a/pyatmos/__init__.py +++ b/pyatmos/__init__.py @@ -6,7 +6,7 @@ estimation of atmospheric properties for various atmospheric models, such as exponential, coesa76, nrlmsise00, and jb2008. ''' - +import os from .standardatmos.expo import expo from .standardatmos.coesa76 import coesa76 @@ -15,7 +15,9 @@ from .jb2008.spaceweather import download_sw_jb2008,read_sw_jb2008 from .msise.nrlmsise00 import nrlmsise00 from .jb2008.jb2008 import jb2008 + from .utils import data_prepare -# Load and update the EOP file and Leap Second file -data_prepare.iers_load() \ No newline at end of file +# Load IERS data based on environment variable +enable_iers_load = os.getenv("ENABLE_IERS_LOAD", "true").lower() == "true" +data_prepare.iers_load(enable_iers_load) \ No newline at end of file diff --git a/pyatmos/utils/data_prepare.py b/pyatmos/utils/data_prepare.py index 371c621..45b42f6 100644 --- a/pyatmos/utils/data_prepare.py +++ b/pyatmos/utils/data_prepare.py @@ -2,11 +2,16 @@ from astropy.utils import iers as iers_astropy from .data_download import download_iers -def iers_load(): - - # load the EOP file - dir_iers,eop_file,leapsecond_file = download_iers() - iers_astropy.conf.auto_download = False - iers_a = iers_astropy.IERS_A.open(eop_file) - leapsecond = iers_astropy.LeapSeconds.from_iers_leap_seconds(leapsecond_file) - eop_table = iers_astropy.earth_orientation_table.set(iers_a) \ No newline at end of file +def iers_load(enable_iers_load=True): + """ + Loads the EOP (Earth Orientation Parameters) and Leap Second files from IERS. + This function downloads the necessary files if they are not found locally, and then sets up the Astropy libraries to use this data. + """ + if enable_iers_load: + # Download the EOP and Leap Second files + dir_iers,eop_file,leapsecond_file = download_iers() + # Load IERS data for Astropy + iers_astropy.conf.auto_download = False # Prevent automatic IERS download by Astropy + iers_a = iers_astropy.IERS_A.open(eop_file) # Load IERS data + leapsecond = iers_astropy.LeapSeconds.from_iers_leap_seconds(leapsecond_file) # Load Leap Second data + eop_table = iers_astropy.earth_orientation_table.set(iers_a) # Configure Astropy to use IERS data