The problem of repeatedly loading IERS data files when other packages call this package has been fixed by dynamically setting environment variables.
This commit is contained in:
		
							parent
							
								
									1814b27b1a
								
							
						
					
					
						commit
						15b691055a
					
				
							
								
								
									
										
											BIN
										
									
								
								pyatmos/.DS_Store
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								pyatmos/.DS_Store
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -6,7 +6,7 @@ estimation of atmospheric properties for various atmospheric models, such | |||||||
| as exponential, coesa76, nrlmsise00, and jb2008.  | as exponential, coesa76, nrlmsise00, and jb2008.  | ||||||
| 
 | 
 | ||||||
| '''     | '''     | ||||||
| 
 | import os | ||||||
| from .standardatmos.expo import expo | from .standardatmos.expo import expo | ||||||
| from .standardatmos.coesa76 import coesa76 | 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 .msise.nrlmsise00 import nrlmsise00 | ||||||
| from .jb2008.jb2008 import jb2008 | from .jb2008.jb2008 import jb2008 | ||||||
|  | 
 | ||||||
| from .utils import data_prepare | from .utils import data_prepare | ||||||
| 
 | 
 | ||||||
| # Load and update the EOP file and Leap Second file | # Load IERS data based on environment variable | ||||||
| data_prepare.iers_load()  | enable_iers_load = os.getenv("ENABLE_IERS_LOAD", "true").lower() == "true" | ||||||
|  | data_prepare.iers_load(enable_iers_load) | ||||||
| @ -2,11 +2,16 @@ from astropy.utils import iers as iers_astropy | |||||||
| 
 | 
 | ||||||
| from .data_download import download_iers | from .data_download import download_iers | ||||||
| 
 | 
 | ||||||
| def iers_load(): | def iers_load(enable_iers_load=True): | ||||||
| 
 |     """ | ||||||
|     # load the EOP file |     Loads the EOP (Earth Orientation Parameters) and Leap Second files from IERS. | ||||||
|     dir_iers,eop_file,leapsecond_file = download_iers()  |     This function downloads the necessary files if they are not found locally, and then sets up the Astropy libraries to use this data. | ||||||
|     iers_astropy.conf.auto_download = False |     """ | ||||||
|     iers_a = iers_astropy.IERS_A.open(eop_file) |     if enable_iers_load: | ||||||
|     leapsecond = iers_astropy.LeapSeconds.from_iers_leap_seconds(leapsecond_file) |         # Download the EOP and Leap Second files | ||||||
|     eop_table = iers_astropy.earth_orientation_table.set(iers_a) |         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 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user