diff --git a/.DS_Store b/.DS_Store index 1e014ef..f27572d 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/README.md b/README.md index feed2c1..956f929 100755 --- a/README.md +++ b/README.md @@ -123,24 +123,26 @@ pip install pyatmos --upgrade # to upgrade a pre-existing installation ``` ## Change log +- **1.2.6 — Mar 08, 2024** + - Implemented the calculation of Associated Legendre polynomials using `scipy`, eliminating the dependency on the `pyshtools` package. - **1.2.5 — Jul 16, 2023** - - Added time system for loading/updating the EOP file and Leap Second file from IERS + - Added time system for loading/updating the EOP file and Leap Second file from IERS. - **1.2.4 — Feb 16, 2023** - - Changed functions `read_sw_nrlmsise00` and `get_sw` due to the space weather file changed from 'SW-ALL.txt' to 'SW-ALL.csv' + - Changed functions `read_sw_nrlmsise00` and `get_sw` due to the space weather file changed from 'SW-ALL.txt' to 'SW-ALL.csv'. - Deleted the colored-progress bar for downloading space weather file, and use `wget` instead. - **1.2.3 — Jun 7, 2021** - Added atmospheric models **JB2008** - - Changed the output of the result to an instance - - Improved the code structure for NRLMSISE-00, and the running speed is nearly threefold + - Changed the output of the result to an instance. + - Improved the code structure for NRLMSISE-00, and the running speed is nearly threefold. - **1.2.1 — Jan 22, 2021** - - Added **Exponential Atmosphere** up to 1000 km - - Added **Committee on Extension to the Standard Atmosphere(COESA)** up to 1000 km - - Completed part of the help documentation for NRLMSISE-00 - - Improved the code structure to make it easier to read + - Added **Exponential Atmosphere** up to 1000 km. + - Added **Committee on Extension to the Standard Atmosphere(COESA)** up to 1000 km. + - Completed part of the help documentation for NRLMSISE-00. + - Improved the code structure to make it easier to read. - **1.1.2 — Jul 26, 2020** - - Added colored-progress bar for downloading data + - Added colored-progress bar for downloading data. - **1.1.0 — Mar 29, 2020** - - Added the International Standard Atmosphere(ISA) Model up to 86kms + - Added the International Standard Atmosphere(ISA) Model. ## Next release diff --git a/pyatmos/.DS_Store b/pyatmos/.DS_Store index dfca1f5..e8941bc 100644 Binary files a/pyatmos/.DS_Store and b/pyatmos/.DS_Store differ diff --git a/pyatmos/msise/nrlmsise00_subfunc.py b/pyatmos/msise/nrlmsise00_subfunc.py index 0e9d224..e569645 100644 --- a/pyatmos/msise/nrlmsise00_subfunc.py +++ b/pyatmos/msise/nrlmsise00_subfunc.py @@ -1,6 +1,6 @@ import numpy as np from scipy.interpolate import CubicSpline -from pyshtools.legendre import PLegendreA,PlmIndex +from scipy.special import lpmv import pkg_resources def nrlmsis00_data(): @@ -275,9 +275,30 @@ def sg0(ex,p,ap): g0(ap[6],p)*ex**12)*(1-ex**8)/(1-ex))/sumex(ex) # =============== 3hr magnetic activity functions =================== # +def PLegendreA(lmax, x): + """ + Calculates all unnormalized associated Legendre polynomials up to degree lmax for a given x value. + + Inputs: + lmax -> [int] The maximum degree of the polynomials to compute. + x -> [float] The value at which to evaluate the polynomials. + Outputs: + res -> [array-like] An array of shape (lmax + 1) * (lmax + 2) // 2 containing the values of the unnormalized associated Legendre polynomials P_l^m(x) for l = 0, 1, ..., lmax and m = 0, 1, ..., l. + Note: The Condon-Shortley phase is excluded. + """ + res = np.zeros((lmax + 1) * (lmax + 2) // 2) + + # Compute P_l^m(x) for all l and m + k = 0 + for l in range(lmax + 1): + for m in range(l + 1): + res_k = lpmv(m, l, x) + if m%2: res_k *= -1 + res[k] = res_k + k += 1 + return res def lengendre(g_lat,lmax = 8): - # Index of PLegendreA_x can be calculated by PlmIndex(l,m) x = np.sin(np.deg2rad(g_lat)) PLegendreA_x = PLegendreA(lmax,x) return PLegendreA_x diff --git a/setup.py b/setup.py index bfc29aa..ee9059a 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup,find_packages setup( name = 'pyatmos', - version = '1.2.5', + version = '1.2.6', description = 'A package to estimate the vertical structure of atmosphere with various atmospheric density models', author = 'Chunxiao Li', author_email = 'lcx366@126.com', @@ -11,13 +11,14 @@ setup( long_description_content_type = 'text/markdown', long_description = open('README.md', 'rb').read().decode('utf-8'), keywords = ['coesa76','nrlmsise00','jb2008'], - python_requires = '>=3.8', + python_requires = '>=3.10', classifiers = [ 'Development Status :: 4 - Beta', 'Intended Audience :: Education', 'Intended Audience :: Science/Research', - 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], packages = find_packages(), @@ -29,7 +30,6 @@ setup( 'numba', 'pandas', 'astropy', - 'pyshtools', 'wget' ] )