From ca268f52575cc4b5616558b1f8b5e14300f4aa03 Mon Sep 17 00:00:00 2001 From: MateusStano Date: Thu, 6 Apr 2023 11:35:44 -0300 Subject: [PATCH 01/12] FIX: netCDF4 >= 1.6.2 --- docs/user/requirements.rst | 6 +++--- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/user/requirements.rst b/docs/user/requirements.rst index fe7b9f1c3..d4d5ca810 100644 --- a/docs/user/requirements.rst +++ b/docs/user/requirements.rst @@ -21,7 +21,7 @@ The following packages are needed in order to run RocketPy: - Numpy >= 1.0 - Scipy >= 1.0 - Matplotlib >= 3.0 -- netCDF4 >= 1.4 +- netCDF4 >= 1.6.2 - windrose >= 1.6.8 - requests - pytz @@ -43,7 +43,7 @@ The packages needed can be installed via ``pip`` by running the following lines pip install "numpy>=1.0" pip install "scipy>=1.0" pip install "matplotlib>=3.0" - pip install "netCDF4>=1.4" + pip install "netCDF4>=1.6.2" pip install "windrose >= 1.6.8" pip install "ipywidgets>=7.6.3" pip install requests @@ -61,7 +61,7 @@ To update Scipy and install netCDF4 using Conda, the following code is used: .. code-block:: shell conda install "scipy>=1.0" - conda install -c anaconda "netcdf4>=1.4" + conda install -c anaconda "netcdf4>=1.6.2" Optional Packages diff --git a/requirements.txt b/requirements.txt index ccfdb4f15..d9585d381 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ numpy>=1.0 scipy>=1.0 matplotlib>=3.0 -netCDF4>=1.4 +netCDF4>=1.6.2 windrose>=1.6.8 ipywidgets>=7.6.3 requests diff --git a/setup.py b/setup.py index 16feee477..593cd12d3 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ "numpy>=1.0", "scipy>=1.0", "matplotlib>=3.0", - "netCDF4>=1.4,<1.6", + "netCDF4>=1.6.2", "windrose>=1.6.8", "ipywidgets>=7.6.3", "requests", From e1454dba5266cf2f86048f5f72f72fd4e6ec3e40 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Thu, 6 Apr 2023 14:42:27 +0000 Subject: [PATCH 02/12] Fix code style issues with Black --- rocketpy/AeroSurfaces.py | 1 - rocketpy/EnvironmentAnalysis.py | 16 +++++++--------- .../EPFL_Bella_Lui/bella_lui_flight_sim.py | 1 + .../acceptance/NDRT_2020/ndrt_2020_flight_sim.py | 1 + 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/rocketpy/AeroSurfaces.py b/rocketpy/AeroSurfaces.py index fcd3064a9..e99562551 100644 --- a/rocketpy/AeroSurfaces.py +++ b/rocketpy/AeroSurfaces.py @@ -1414,7 +1414,6 @@ def geometricInfo(self): return None def aerodynamicInfo(self): - print(f"\nTail name: {self.name}") print(f"Tail Center of Pressure: {self.cp}") print(f"Tail Lift Coefficient Slope: {self.clalpha}") diff --git a/rocketpy/EnvironmentAnalysis.py b/rocketpy/EnvironmentAnalysis.py index e318e043c..85b4d8327 100644 --- a/rocketpy/EnvironmentAnalysis.py +++ b/rocketpy/EnvironmentAnalysis.py @@ -637,7 +637,6 @@ def parsePressureLevelData(self): # Loop through time and save all values for timeIndex, timeNum in enumerate(timeNumArray): - dateString, hourString, dateTime = self.__timeNumToDateString( timeNum, timeNumArray.units, calendar="gregorian" ) @@ -820,7 +819,6 @@ def parseSurfaceData(self): # Loop through time and save all values for timeIndex, timeNum in enumerate(timeNumArray): - dateString, hourString, dateTime = self.__timeNumToDateString( timeNum, timeNumArray.units, calendar="gregorian" ) @@ -2130,7 +2128,7 @@ def plot_wind_gust_distribution_over_average_day(self): gs = fig.add_gridspec(nrows, ncols, hspace=0, wspace=0, left=0.12) axs = gs.subplots(sharex=True, sharey=True) x_min, x_max, y_min, y_max = 0, 0, 0, 0 - for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]: + for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]: hour = hours[i * ncols + j] ax = axs[i, j] ax.set_title(f"{float(hour):05.2f}".replace(".", ":"), y=0.8) @@ -2290,7 +2288,7 @@ def plot_sustained_surface_wind_speed_distribution_over_average_day( gs = fig.add_gridspec(nrows, ncols, hspace=0, wspace=0, left=0.12) axs = gs.subplots(sharex=True, sharey=True) x_min, x_max, y_min, y_max = 0, 0, 0, 0 - for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]: + for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]: hour = hours[i * ncols + j] ax = axs[i, j] ax.set_title(f"{float(hour):05.2f}".replace(".", ":"), y=0.8) @@ -2334,7 +2332,7 @@ def plot_sustained_surface_wind_speed_distribution_over_average_day( ) if windSpeedLimit: - for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]: + for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]: # Clear Sky Range Altitude Limits j] ax = axs[i, j] ax.vlines( @@ -2656,7 +2654,7 @@ def plot_wind_profile_over_average_day(self, clear_range_limits=False): gs = fig.add_gridspec(nrows, ncols, hspace=0, wspace=0, left=0.12) axs = gs.subplots(sharex=True, sharey=True) x_min, x_max, y_min, y_max = 0, 0, np.inf, 0 - for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]: + for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]: hour = hours[i * ncols + j] ax = axs[i, j] ax.plot(*self.average_wind_profile_at_given_hour[hour], "r-") @@ -2689,7 +2687,7 @@ def plot_wind_profile_over_average_day(self, clear_range_limits=False): ) if clear_range_limits: - for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]: + for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]: # Clear Sky Range Altitude Limits ax = axs[i, j] ax.fill_between( @@ -2794,7 +2792,7 @@ def plot_wind_heading_profile_over_average_day(self, clear_range_limits=False): gs = fig.add_gridspec(nrows, ncols, hspace=0, wspace=0, left=0.12) axs = gs.subplots(sharex=True, sharey=True) x_min, x_max, y_min, y_max = 0, 0, np.inf, 0 - for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]: + for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]: hour = hours[i * ncols + j] ax = axs[i, j] ax.plot(*self.average_wind_heading_profile_at_given_hour[hour], "r-") @@ -2819,7 +2817,7 @@ def plot_wind_heading_profile_over_average_day(self, clear_range_limits=False): ) if clear_range_limits: - for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]: + for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]: # Clear Sky range limits ax = axs[i, j] ax.fill_between( diff --git a/tests/fixtures/acceptance/EPFL_Bella_Lui/bella_lui_flight_sim.py b/tests/fixtures/acceptance/EPFL_Bella_Lui/bella_lui_flight_sim.py index dfa7de298..cdfc52d45 100644 --- a/tests/fixtures/acceptance/EPFL_Bella_Lui/bella_lui_flight_sim.py +++ b/tests/fixtures/acceptance/EPFL_Bella_Lui/bella_lui_flight_sim.py @@ -112,6 +112,7 @@ distanceToCM=parameters.get("tailDistanceToCM")[0], ) + # Parachute set-up def drogueTrigger(p, y): # p = pressure diff --git a/tests/fixtures/acceptance/NDRT_2020/ndrt_2020_flight_sim.py b/tests/fixtures/acceptance/NDRT_2020/ndrt_2020_flight_sim.py index 80b0f3373..854a0b981 100644 --- a/tests/fixtures/acceptance/NDRT_2020/ndrt_2020_flight_sim.py +++ b/tests/fixtures/acceptance/NDRT_2020/ndrt_2020_flight_sim.py @@ -122,6 +122,7 @@ distanceToCM=parameters.get("transitiondistanceToCM")[0], ) + # Parachute set-up def drogueTrigger(p, y): # p = pressure From db072c0332bc6573fb59c112f786c38f620fb82c Mon Sep 17 00:00:00 2001 From: Giovani Hidalgo Ceotto Date: Sun, 9 Apr 2023 23:20:57 -0300 Subject: [PATCH 03/12] MAINT: Adjust netCDF4 requirement for Py 3.7, 3.11 and Colab --- docs/user/requirements.rst | 6 +++--- requirements.txt | 3 ++- setup.py | 13 ++++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/user/requirements.rst b/docs/user/requirements.rst index d4d5ca810..a6a5c07ef 100644 --- a/docs/user/requirements.rst +++ b/docs/user/requirements.rst @@ -8,7 +8,6 @@ Python Version -------------- RocketPy supports Python 3.7 and above. -Support for Python 3.11 is still limited by some dependencies. Sorry, there are currently no plans to support earlier versions. If you really need to run RocketPy on Python 3.6 or earlier, feel free to submit an issue and we will see what we can do! @@ -21,7 +20,7 @@ The following packages are needed in order to run RocketPy: - Numpy >= 1.0 - Scipy >= 1.0 - Matplotlib >= 3.0 -- netCDF4 >= 1.6.2 +- netCDF4 >= 1.4, < 1.6 for Python 3.7+, netCDF4 >= 1.6.2 for Python 3.11 - windrose >= 1.6.8 - requests - pytz @@ -29,10 +28,11 @@ The following packages are needed in order to run RocketPy: - ipywidgets >= 7.6.3 - jsonpickle - All of these packages, are automatically installed when RocketPy is installed using either ``pip`` or ``conda``. However, in case the user wants to install these packages manually, they can do so by following the instructions bellow. +Note: Google Colab and netCDF4 don't play well together for netCDF4 >= 1.6 (see `this issue `_). If you are using Google Colab, you should install netCDF4 < 1.6 or use `condacolab `_) to install netCDF4 >= 1.6. + Installing Required Packages Using ``pip`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/requirements.txt b/requirements.txt index d9585d381..3d9fc3e49 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,8 @@ numpy>=1.0 scipy>=1.0 matplotlib>=3.0 -netCDF4>=1.6.2 +netCDF4>=1.4,<1.6; python_version == "3.7" +netCDF4>=1.6.2; python_version != "3.7" windrose>=1.6.8 ipywidgets>=7.6.3 requests diff --git a/setup.py b/setup.py index 593cd12d3..8b46085fe 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,19 @@ +import sys import setuptools with open("README.md", "r") as fh: long_description = fh.read() + +# Manage different netCDF4 versions depending on system version and Google Colab +netCDF4_requirement = "netCDF4>=1.6.2" +if sys.version_info[0] == 3 and sys.version_info[1] == 7: + # Support for Python 3.7 + netCDF4_requirement = "netCDF4>=1.4,<1.6" +if "google.colab" in sys.modules: + # Support for Google Colab + netCDF4_requirement = "netCDF4>=1.4,<1.6" + setuptools.setup( name="rocketpy", version="0.13.0", @@ -10,7 +21,7 @@ "numpy>=1.0", "scipy>=1.0", "matplotlib>=3.0", - "netCDF4>=1.6.2", + netCDF4_requirement, "windrose>=1.6.8", "ipywidgets>=7.6.3", "requests", From 252f4a89175dd5ca0dcc12fe7565f9046753af6d Mon Sep 17 00:00:00 2001 From: Giovani Hidalgo Ceotto Date: Sun, 9 Apr 2023 23:22:42 -0300 Subject: [PATCH 04/12] REL: bump version to 0.13.1 --- docs/conf.py | 2 +- docs/user/installation.rst | 2 +- rocketpy/__init__.py | 2 +- setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 44d9a48d9..925ea26d1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,7 +24,7 @@ author = "Giovani Hidalgo Ceotto" # The full version, including alpha/beta/rc tags -release = "0.13.0" +release = "0.13.1" # -- General configuration --------------------------------------------------- diff --git a/docs/user/installation.rst b/docs/user/installation.rst index 3a3640930..fb9a64d2d 100644 --- a/docs/user/installation.rst +++ b/docs/user/installation.rst @@ -19,7 +19,7 @@ If you want to choose a specific version to guarantee compatibility, you may ins .. code-block:: shell - pip install rocketpy==0.13.0 + pip install rocketpy==0.13.1 Optional Installation Method: ``conda`` diff --git a/rocketpy/__init__.py b/rocketpy/__init__.py index bcc164608..c47529d39 100644 --- a/rocketpy/__init__.py +++ b/rocketpy/__init__.py @@ -16,7 +16,7 @@ __copyright__ = "Copyright 20XX, Projeto Jupiter" __credits__ = ["Matheus Marques Araujo", "Rodrigo Schmitt", "Guilherme Tavares"] __license__ = "MIT" -__version__ = "0.13.0" +__version__ = "0.13.1" __maintainer__ = "Giovani Hidalgo Ceotto" __email__ = "ghceotto@gmail.com" __status__ = "Production" diff --git a/setup.py b/setup.py index 8b46085fe..aa18cd0d0 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setuptools.setup( name="rocketpy", - version="0.13.0", + version="0.13.1", install_requires=[ "numpy>=1.0", "scipy>=1.0", From 3c6f115c5ccc988e4497a78cdcc407c3a36b507b Mon Sep 17 00:00:00 2001 From: Giovani Hidalgo Ceotto Date: Sun, 9 Apr 2023 23:53:01 -0300 Subject: [PATCH 05/12] MAINT: change how Google Colab is detected in setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index aa18cd0d0..aad141761 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +import os import sys import setuptools @@ -10,7 +11,7 @@ if sys.version_info[0] == 3 and sys.version_info[1] == 7: # Support for Python 3.7 netCDF4_requirement = "netCDF4>=1.4,<1.6" -if "google.colab" in sys.modules: +if os.getenv("COLAB_RELEASE_TAG"): # Support for Google Colab netCDF4_requirement = "netCDF4>=1.4,<1.6" From db3e9c380ba8890e8ea8c4d587d98c3e74365f2e Mon Sep 17 00:00:00 2001 From: Giovani Hidalgo Ceotto Date: Mon, 10 Apr 2023 00:12:21 -0300 Subject: [PATCH 06/12] TST: Add Python 3.11.3 to CI --- .github/workflows/test_pytest.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_pytest.yaml b/.github/workflows/test_pytest.yaml index d8bd00f70..6be7b3d73 100644 --- a/.github/workflows/test_pytest.yaml +++ b/.github/workflows/test_pytest.yaml @@ -13,6 +13,7 @@ jobs: - windows-latest python-version: - 3.7 + - 3.11.3 steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} From fb1bdb272be73f6b18e28a14b84355179c4098db Mon Sep 17 00:00:00 2001 From: Giovani Hidalgo Ceotto Date: Sat, 15 Apr 2023 15:42:41 +0000 Subject: [PATCH 07/12] BLD: setup netCDF4 version requirements for different systems Co-authors: @MateusStano @phmbressan @CabGT --- .github/workflows/test_pytest.yaml | 2 ++ setup.py | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_pytest.yaml b/.github/workflows/test_pytest.yaml index 6be7b3d73..fe18652ac 100644 --- a/.github/workflows/test_pytest.yaml +++ b/.github/workflows/test_pytest.yaml @@ -13,6 +13,7 @@ jobs: - windows-latest python-version: - 3.7 + - 3.9 - 3.11.3 steps: - uses: actions/checkout@v2 @@ -30,5 +31,6 @@ jobs: - name: Test with pytest run: | pytest + pytest -k 'test_gfs_atmosphere' cd rocketpy pytest --doctest-modules \ No newline at end of file diff --git a/setup.py b/setup.py index aad141761..b43db3c5b 100644 --- a/setup.py +++ b/setup.py @@ -5,15 +5,23 @@ with open("README.md", "r") as fh: long_description = fh.read() - # Manage different netCDF4 versions depending on system version and Google Colab netCDF4_requirement = "netCDF4>=1.6.2" -if sys.version_info[0] == 3 and sys.version_info[1] == 7: +if sys.version_info[1] == 7: # Support for Python 3.7 netCDF4_requirement = "netCDF4>=1.4,<1.6" -if os.getenv("COLAB_RELEASE_TAG"): - # Support for Google Colab - netCDF4_requirement = "netCDF4>=1.4,<1.6" + +# Check if running on a linux system +elif sys.platform in ["linux", "darwin"]: + if sys.version_info[1] < 11: + # Support for Linux with Python < 3.11 + # Avoid problems due to netcdf4 issue linked below + netCDF4_requirement = "netCDF4>=1.4,<1.6" + else: + # Support for Linux with Python >= 3.11 + # Might have problems with openDAP in the Environment class due to + # https://github.com/Unidata/netcdf4-python/issues/1179 + netCDF4_requirement = "netCDF4>=1.6.2" setuptools.setup( name="rocketpy", From 94b8790b6e6856aac99a50c8fedce8844128e889 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Sat, 15 Apr 2023 15:43:14 +0000 Subject: [PATCH 08/12] Fix code style issues with Black --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b43db3c5b..4b3f6045e 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ netCDF4_requirement = "netCDF4>=1.4,<1.6" else: # Support for Linux with Python >= 3.11 - # Might have problems with openDAP in the Environment class due to + # Might have problems with openDAP in the Environment class due to # https://github.com/Unidata/netcdf4-python/issues/1179 netCDF4_requirement = "netCDF4>=1.6.2" From 3f1cc31a53f1599f85a670246fd270051a867f71 Mon Sep 17 00:00:00 2001 From: Giovani Hidalgo Ceotto Date: Sat, 15 Apr 2023 15:46:18 +0000 Subject: [PATCH 09/12] TEMP: fix build runslow tests --- .github/workflows/test_pytest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_pytest.yaml b/.github/workflows/test_pytest.yaml index fe18652ac..f71f93d43 100644 --- a/.github/workflows/test_pytest.yaml +++ b/.github/workflows/test_pytest.yaml @@ -31,6 +31,6 @@ jobs: - name: Test with pytest run: | pytest - pytest -k 'test_gfs_atmosphere' + pytest -k 'test_gfs_atmosphere' --runslow cd rocketpy pytest --doctest-modules \ No newline at end of file From 1584ffb8a18985ecd4485b7e28993e9cc408ccc2 Mon Sep 17 00:00:00 2001 From: Giovani Hidalgo Ceotto Date: Sat, 15 Apr 2023 16:04:24 +0000 Subject: [PATCH 10/12] BLD: allow newest netCDF4 version in macos --- .github/workflows/test_pytest.yaml | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_pytest.yaml b/.github/workflows/test_pytest.yaml index f71f93d43..a2486ba46 100644 --- a/.github/workflows/test_pytest.yaml +++ b/.github/workflows/test_pytest.yaml @@ -15,6 +15,9 @@ jobs: - 3.7 - 3.9 - 3.11.3 + exclude: + - os: ubuntu-latest + python-version: 3.11.3 steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/setup.py b/setup.py index 4b3f6045e..591ae3447 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ netCDF4_requirement = "netCDF4>=1.4,<1.6" # Check if running on a linux system -elif sys.platform in ["linux", "darwin"]: +elif sys.platform == "linux": if sys.version_info[1] < 11: # Support for Linux with Python < 3.11 # Avoid problems due to netcdf4 issue linked below From 8373e72a0bca7215aed11d6a55d8be960006f590 Mon Sep 17 00:00:00 2001 From: Giovani Hidalgo Ceotto Date: Sat, 15 Apr 2023 16:10:57 +0000 Subject: [PATCH 11/12] TST: fix github actions test --- .github/workflows/test_pytest.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/test_pytest.yaml b/.github/workflows/test_pytest.yaml index a2486ba46..ebd84b465 100644 --- a/.github/workflows/test_pytest.yaml +++ b/.github/workflows/test_pytest.yaml @@ -13,11 +13,7 @@ jobs: - windows-latest python-version: - 3.7 - - 3.9 - - 3.11.3 - exclude: - - os: ubuntu-latest - python-version: 3.11.3 + - 3.11 steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -34,6 +30,5 @@ jobs: - name: Test with pytest run: | pytest - pytest -k 'test_gfs_atmosphere' --runslow cd rocketpy pytest --doctest-modules \ No newline at end of file From b00d4c5069ba6ff0294c5f09300b4fb722a3b971 Mon Sep 17 00:00:00 2001 From: Giovani Hidalgo Ceotto Date: Sat, 15 Apr 2023 16:11:26 +0000 Subject: [PATCH 12/12] FIX: wrong operator in __sub__ --- rocketpy/Function.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocketpy/Function.py b/rocketpy/Function.py index f0d64e60b..4b9d09488 100644 --- a/rocketpy/Function.py +++ b/rocketpy/Function.py @@ -2085,7 +2085,7 @@ def __sub__(self, other): # Create new Function object return Function(source, inputs, outputs, interpolation) else: - return Function(lambda x: (self.getValue(x) * other(x))) + return Function(lambda x: (self.getValue(x) - other(x))) # If other is Float except... except AttributeError: if isinstance(other, (float, int, complex)):