From a1a723020bdbff1f564b8256f5d907423787342b Mon Sep 17 00:00:00 2001 From: Chunxiao Li Date: Mon, 27 Jul 2020 10:38:52 +0800 Subject: [PATCH] minor bug fixes --- .DS_Store | Bin 6148 -> 6148 bytes README.md | 2 + pyatmos/.DS_Store | Bin 8196 -> 8196 bytes pyatmos/StandardAtmosphere/__init__.py | 4 +- pyatmos/msise/__init__.py | 18 ++------- pyatmos/msise/nrlmsise00.py | 2 +- pyatmos/msise/spaceweather.py | 28 +++---------- pyatmos/utils/__init__.py | 16 ++++++++ .../{msise/utils.py => utils/try_download.py} | 38 +++--------------- pyatmos/utils/utils.py | 21 ++++++++++ setup.py | 2 +- 11 files changed, 56 insertions(+), 75 deletions(-) create mode 100644 pyatmos/utils/__init__.py rename pyatmos/{msise/utils.py => utils/try_download.py} (54%) create mode 100644 pyatmos/utils/utils.py diff --git a/.DS_Store b/.DS_Store index dae08057fe1ee84c0ddc71a473e039afdaa29bb8..c5b5c73d8ae8f16daa3feffc6e4a6ff9b749c42c 100644 GIT binary patch delta 19 acmZoMXffDun~BZTR7b(mV)H{LWl;b?*9Gwa delta 19 acmZoMXffDun~BZbL`T8YaPvbZWl;b?odxFr diff --git a/README.md b/README.md index d8ba997..b658df6 100755 --- a/README.md +++ b/README.md @@ -114,6 +114,8 @@ Calculate the temperatures, densities including anomalous oxygen using the NRLMS ``` ## Change log +- **1.1.2 — Jul 26, 2020** + - Added progress bar for downloading data - **1.1.0 — Mar 29, 2020** - Added the International Standard Atmosphere(ISA) Model up to 86km diff --git a/pyatmos/.DS_Store b/pyatmos/.DS_Store index fd0e248a22a90b4225502abb6bce7f8b9061acc6..279bd60b3b84f5dc431792bf28fc140847bb127c 100644 GIT binary patch delta 409 zcmZp1XmOa}&nUSuU^hRbZ9S4yPP$=ma(-?B0|Fq)=H|P&B<18M0VO%2ij+7Hq#beu ivQbo|5KvK&fo=m2vH_d5MH3k}vr8DW4j~uEF#-UjLtO9x delta 81 zcmZp1XmOa}&nUbxU^hRb@MIo=*=*(}Itr$So7W0VWrVUPuN83I+$rP-<8Qtz9Lu 180: - lonwrap = lon - 360 - else: - lonwrap = lon - return lonwrap - -# =========================== convert time ========================== # - -def hms2s(h,m,s): - return h*3.6E3 + m*60 + s - -def hms2h(h,m,s): - return h + m/60 + s/3.6E3 def tqdm_request(url,dir_to,file,desc): + ''' + Try to download files from a remote server by request. + ''' block_size = 1024 bar_format = "{l_bar}%s{bar}%s{r_bar}" % (Fore.BLUE, Fore.RESET) for idownload in range(5): @@ -56,5 +27,6 @@ def tqdm_request(url,dir_to,file,desc): print('No response, skip this file.') finally: pbar.close() - local_file.close() + local_file.close() + res.close() diff --git a/pyatmos/utils/utils.py b/pyatmos/utils/utils.py new file mode 100644 index 0000000..74ef998 --- /dev/null +++ b/pyatmos/utils/utils.py @@ -0,0 +1,21 @@ +def wraplon(lon): + ''' + Wrap a longitude in range of [0,360] to [-180,180] + ''' + if lon > 180: + lonwrap = lon - 360 + else: + lonwrap = lon + return lonwrap + +def hms2s(h,m,s): + ''' + Convert hour/minute/second to seconds + ''' + return h*3.6E3 + m*60 + s + +def hms2h(h,m,s): + ''' + Convert hour/minute/second to hours + ''' + return h + m/60 + s/3.6E3 \ No newline at end of file diff --git a/setup.py b/setup.py index df7cfb4..44cc27a 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup setup( name='pyatmos', - version='1.1.1', + version='1.1.2', long_description_content_type='text/markdown', description='A package to estimate the atmosphere parameters', long_description=open('README.md', 'rb').read().decode('utf-8'),