Skip to content

HotFix for Python 3.11 #348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test_pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
- windows-latest
python-version:
- 3.7
- 3.11
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/user/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
Expand Down
10 changes: 5 additions & 5 deletions docs/user/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand All @@ -21,18 +20,19 @@ The following packages are needed in order to run RocketPy:
- Numpy >= 1.0
- Scipy >= 1.0
- Matplotlib >= 3.0
- netCDF4 >= 1.4
- netCDF4 >= 1.4, < 1.6 for Python 3.7+, netCDF4 >= 1.6.2 for Python 3.11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this code line already working properly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is documentation. It shouldnbe working. Are you getting errors when building the docs?

- windrose >= 1.6.8
- requests
- pytz
- simplekml
- 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 <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.

Installing Required Packages Using ``pip``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
numpy>=1.0
scipy>=1.0
matplotlib>=3.0
netCDF4>=1.4
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
Expand Down
1 change: 0 additions & 1 deletion rocketpy/AeroSurfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
16 changes: 7 additions & 9 deletions rocketpy/EnvironmentAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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-")
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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-")
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion rocketpy/Function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand Down
2 changes: 1 addition & 1 deletion rocketpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = "[email protected]"
__status__ = "Production"
Expand Down
24 changes: 22 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
import os
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[1] == 7:
# Support for Python 3.7
netCDF4_requirement = "netCDF4>=1.4,<1.6"

# Check if running on a linux system
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
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",
version="0.13.0",
version="0.13.1",
install_requires=[
"numpy>=1.0",
"scipy>=1.0",
"matplotlib>=3.0",
"netCDF4>=1.4,<1.6",
netCDF4_requirement,
"windrose>=1.6.8",
"ipywidgets>=7.6.3",
"requests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
distanceToCM=parameters.get("tailDistanceToCM")[0],
)


# Parachute set-up
def drogueTrigger(p, y):
# p = pressure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
distanceToCM=parameters.get("transitiondistanceToCM")[0],
)


# Parachute set-up
def drogueTrigger(p, y):
# p = pressure
Expand Down