Skip to content

Commit abcbdcb

Browse files
authored
Merge pull request #348 from RocketPy-Team/hotfix-python311
HotFix for Python 3.11
2 parents 61a21d2 + b00d4c5 commit abcbdcb

File tree

12 files changed

+43
-22
lines changed

12 files changed

+43
-22
lines changed

.github/workflows/test_pytest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- windows-latest
1414
python-version:
1515
- 3.7
16+
- 3.11
1617
steps:
1718
- uses: actions/checkout@v2
1819
- name: Set up Python ${{ matrix.python-version }}

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
author = "Giovani Hidalgo Ceotto"
2525

2626
# The full version, including alpha/beta/rc tags
27-
release = "0.13.0"
27+
release = "0.13.1"
2828

2929

3030
# -- General configuration ---------------------------------------------------

docs/user/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you want to choose a specific version to guarantee compatibility, you may ins
1919

2020
.. code-block:: shell
2121
22-
pip install rocketpy==0.13.0
22+
pip install rocketpy==0.13.1
2323
2424
2525
Optional Installation Method: ``conda``

docs/user/requirements.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Python Version
88
--------------
99

1010
RocketPy supports Python 3.7 and above.
11-
Support for Python 3.11 is still limited by some dependencies.
1211
Sorry, there are currently no plans to support earlier versions.
1312
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!
1413

@@ -21,18 +20,19 @@ The following packages are needed in order to run RocketPy:
2120
- Numpy >= 1.0
2221
- Scipy >= 1.0
2322
- Matplotlib >= 3.0
24-
- netCDF4 >= 1.4
23+
- netCDF4 >= 1.4, < 1.6 for Python 3.7+, netCDF4 >= 1.6.2 for Python 3.11
2524
- windrose >= 1.6.8
2625
- requests
2726
- pytz
2827
- simplekml
2928
- ipywidgets >= 7.6.3
3029
- jsonpickle
3130

32-
3331
All of these packages, are automatically installed when RocketPy is installed using either ``pip`` or ``conda``.
3432
However, in case the user wants to install these packages manually, they can do so by following the instructions bellow.
3533

34+
Note: Google Colab and netCDF4 don't play well together for netCDF4 >= 1.6 (see `this issue <https://github.com/Unidata/netcdf4-python/issues/1179>`_). If you are using Google Colab, you should install netCDF4 < 1.6 or use `condacolab <https://github.com/conda-incubator/condacolab>`_) to install netCDF4 >= 1.6.
35+
3636
Installing Required Packages Using ``pip``
3737
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3838

@@ -43,7 +43,7 @@ The packages needed can be installed via ``pip`` by running the following lines
4343
pip install "numpy>=1.0"
4444
pip install "scipy>=1.0"
4545
pip install "matplotlib>=3.0"
46-
pip install "netCDF4>=1.4"
46+
pip install "netCDF4>=1.6.2"
4747
pip install "windrose >= 1.6.8"
4848
pip install "ipywidgets>=7.6.3"
4949
pip install requests
@@ -61,7 +61,7 @@ To update Scipy and install netCDF4 using Conda, the following code is used:
6161
.. code-block:: shell
6262
6363
conda install "scipy>=1.0"
64-
conda install -c anaconda "netcdf4>=1.4"
64+
conda install -c anaconda "netcdf4>=1.6.2"
6565
6666
6767
Optional Packages

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
numpy>=1.0
22
scipy>=1.0
33
matplotlib>=3.0
4-
netCDF4>=1.4
4+
netCDF4>=1.4,<1.6; python_version == "3.7"
5+
netCDF4>=1.6.2; python_version != "3.7"
56
windrose>=1.6.8
67
ipywidgets>=7.6.3
78
requests

rocketpy/AeroSurfaces.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,6 @@ def geometricInfo(self):
14141414
return None
14151415

14161416
def aerodynamicInfo(self):
1417-
14181417
print(f"\nTail name: {self.name}")
14191418
print(f"Tail Center of Pressure: {self.cp}")
14201419
print(f"Tail Lift Coefficient Slope: {self.clalpha}")

rocketpy/EnvironmentAnalysis.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,6 @@ def parsePressureLevelData(self):
637637

638638
# Loop through time and save all values
639639
for timeIndex, timeNum in enumerate(timeNumArray):
640-
641640
dateString, hourString, dateTime = self.__timeNumToDateString(
642641
timeNum, timeNumArray.units, calendar="gregorian"
643642
)
@@ -820,7 +819,6 @@ def parseSurfaceData(self):
820819

821820
# Loop through time and save all values
822821
for timeIndex, timeNum in enumerate(timeNumArray):
823-
824822
dateString, hourString, dateTime = self.__timeNumToDateString(
825823
timeNum, timeNumArray.units, calendar="gregorian"
826824
)
@@ -2130,7 +2128,7 @@ def plot_wind_gust_distribution_over_average_day(self):
21302128
gs = fig.add_gridspec(nrows, ncols, hspace=0, wspace=0, left=0.12)
21312129
axs = gs.subplots(sharex=True, sharey=True)
21322130
x_min, x_max, y_min, y_max = 0, 0, 0, 0
2133-
for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]:
2131+
for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]:
21342132
hour = hours[i * ncols + j]
21352133
ax = axs[i, j]
21362134
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(
22902288
gs = fig.add_gridspec(nrows, ncols, hspace=0, wspace=0, left=0.12)
22912289
axs = gs.subplots(sharex=True, sharey=True)
22922290
x_min, x_max, y_min, y_max = 0, 0, 0, 0
2293-
for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]:
2291+
for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]:
22942292
hour = hours[i * ncols + j]
22952293
ax = axs[i, j]
22962294
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(
23342332
)
23352333

23362334
if windSpeedLimit:
2337-
for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]:
2335+
for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]:
23382336
# Clear Sky Range Altitude Limits j]
23392337
ax = axs[i, j]
23402338
ax.vlines(
@@ -2656,7 +2654,7 @@ def plot_wind_profile_over_average_day(self, clear_range_limits=False):
26562654
gs = fig.add_gridspec(nrows, ncols, hspace=0, wspace=0, left=0.12)
26572655
axs = gs.subplots(sharex=True, sharey=True)
26582656
x_min, x_max, y_min, y_max = 0, 0, np.inf, 0
2659-
for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]:
2657+
for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]:
26602658
hour = hours[i * ncols + j]
26612659
ax = axs[i, j]
26622660
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):
26892687
)
26902688

26912689
if clear_range_limits:
2692-
for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]:
2690+
for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]:
26932691
# Clear Sky Range Altitude Limits
26942692
ax = axs[i, j]
26952693
ax.fill_between(
@@ -2794,7 +2792,7 @@ def plot_wind_heading_profile_over_average_day(self, clear_range_limits=False):
27942792
gs = fig.add_gridspec(nrows, ncols, hspace=0, wspace=0, left=0.12)
27952793
axs = gs.subplots(sharex=True, sharey=True)
27962794
x_min, x_max, y_min, y_max = 0, 0, np.inf, 0
2797-
for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]:
2795+
for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]:
27982796
hour = hours[i * ncols + j]
27992797
ax = axs[i, j]
28002798
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):
28192817
)
28202818

28212819
if clear_range_limits:
2822-
for (i, j) in [(i, j) for i in range(nrows) for j in range(ncols)]:
2820+
for i, j in [(i, j) for i in range(nrows) for j in range(ncols)]:
28232821
# Clear Sky range limits
28242822
ax = axs[i, j]
28252823
ax.fill_between(

rocketpy/Function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2085,7 +2085,7 @@ def __sub__(self, other):
20852085
# Create new Function object
20862086
return Function(source, inputs, outputs, interpolation)
20872087
else:
2088-
return Function(lambda x: (self.getValue(x) * other(x)))
2088+
return Function(lambda x: (self.getValue(x) - other(x)))
20892089
# If other is Float except...
20902090
except AttributeError:
20912091
if isinstance(other, (float, int, complex)):

rocketpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
__copyright__ = "Copyright 20XX, Projeto Jupiter"
1717
__credits__ = ["Matheus Marques Araujo", "Rodrigo Schmitt", "Guilherme Tavares"]
1818
__license__ = "MIT"
19-
__version__ = "0.13.0"
19+
__version__ = "0.13.1"
2020
__maintainer__ = "Giovani Hidalgo Ceotto"
2121
__email__ = "[email protected]"
2222
__status__ = "Production"

setup.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
1+
import os
2+
import sys
13
import setuptools
24

35
with open("README.md", "r") as fh:
46
long_description = fh.read()
57

8+
# Manage different netCDF4 versions depending on system version and Google Colab
9+
netCDF4_requirement = "netCDF4>=1.6.2"
10+
if sys.version_info[1] == 7:
11+
# Support for Python 3.7
12+
netCDF4_requirement = "netCDF4>=1.4,<1.6"
13+
14+
# Check if running on a linux system
15+
elif sys.platform == "linux":
16+
if sys.version_info[1] < 11:
17+
# Support for Linux with Python < 3.11
18+
# Avoid problems due to netcdf4 issue linked below
19+
netCDF4_requirement = "netCDF4>=1.4,<1.6"
20+
else:
21+
# Support for Linux with Python >= 3.11
22+
# Might have problems with openDAP in the Environment class due to
23+
# https://github.com/Unidata/netcdf4-python/issues/1179
24+
netCDF4_requirement = "netCDF4>=1.6.2"
25+
626
setuptools.setup(
727
name="rocketpy",
8-
version="0.13.0",
28+
version="0.13.1",
929
install_requires=[
1030
"numpy>=1.0",
1131
"scipy>=1.0",
1232
"matplotlib>=3.0",
13-
"netCDF4>=1.4,<1.6",
33+
netCDF4_requirement,
1434
"windrose>=1.6.8",
1535
"ipywidgets>=7.6.3",
1636
"requests",

0 commit comments

Comments
 (0)