From bb27aeada6a56298f0e32fd550306cf081dbd915 Mon Sep 17 00:00:00 2001 From: Chunxiao Li Date: Tue, 26 May 2020 20:43:40 +0800 Subject: [PATCH] Update spaceweather.py solve the issue that download fails for spaceweather file on windows platform. --- pyatmos/msise/spaceweather.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyatmos/msise/spaceweather.py b/pyatmos/msise/spaceweather.py index f93332b..9bd0b5f 100644 --- a/pyatmos/msise/spaceweather.py +++ b/pyatmos/msise/spaceweather.py @@ -16,7 +16,8 @@ get_sw - Extract the space weather data import numpy as np from datetime import datetime,timedelta -from os import getenv,path,makedirs,remove +from os import path,makedirs,remove +from pathlib import Path from urllib.request import urlretrieve # =================== download and update sw data =================== # @@ -48,7 +49,7 @@ def download_sw(direc=None): ''' if direc is None: - home = getenv('HOME') + home = str(Path.home()) direc = home + '/src/sw-data/' swfile = direc + 'SW-All.txt' @@ -147,4 +148,4 @@ def get_sw(SW_OBS_PRE,t_ymd,hour): aph_1233 = np.average(aph_tmp[apc_index+4:apc_index+12]) aph_3657 = np.average(aph_tmp[apc_index+12:apc_index+20]) aph = np.hstack((ap,aph_c369,aph_1233,aph_3657)) - return f107A,f107,ap,aph \ No newline at end of file + return f107A,f107,ap,aph