BUG: forecast and reanalysis models - update ECMWF weather model variables dictionary by WilliamArmst · Pull Request #736 · RocketPy-Team/RocketPy
Well, I tried with the ndrt_2020_weather_data_ERA5_new but it didn't work out.
c:\Users\guiga\Documents\github\RocketPy\tests\acceptance\test_ndrt_2020_rocket.py::test_ndrt_2020_rocket_data_asserts_acceptance[data/weather/ndrt_2020_weather_data_ERA5_new.nc] failed: env_file = 'data/weather/ndrt_2020_weather_data_ERA5_new.nc'
@pytest.mark.parametrize(
"env_file",
[
"data/weather/ndrt_2020_weather_data_ERA5.nc",
"data/weather/ndrt_2020_weather_data_ERA5_new.nc",
],
)
def test_ndrt_2020_rocket_data_asserts_acceptance(env_file):
# Notre Dame Rocket Team 2020 Flight
# Launched at 19045-18879 Avery Rd, Three Oaks, MI 49128
# Permission to use flight data given by Brooke Mumma, 2020
#
# IMPORTANT RESULTS (23rd feb)
# Measured Stability Margin 2.875 cal
# Official Target Altitude 4,444 ft
# Measured Altitude 4,320 ft or 1316.736 m
# Drift: 2275 ft
# Importing libraries
# Defining all parameters
parameters = {
# Mass Details
"rocket_mass": (23.321 - 2.475 - 1, 0.010),
# propulsion details
"impulse": (4895.050, 0.033 * 4895.050),
"burn_time": (3.45, 0.1),
"nozzle_radius": (49.5 / 2000, 0.001),
"throat_radius": (21.5 / 2000, 0.001),
"grain_separation": (3 / 1000, 0.001),
"grain_density": (1519.708, 30),
"grain_outer_radius": (33 / 1000, 0.001),
"grain_initial_inner_radius": (15 / 1000, 0.002),
"grain_initial_height": (120 / 1000, 0.001),
# aerodynamic details
"drag_coefficient": (0.44, 0.1),
"inertia_i": (83.351, 0.3 * 83.351),
"inertia_z": (0.15982, 0.3 * 0.15982),
"radius": (203 / 2000, 0.001),
"distance_rocket_nozzle": (-1.255, 0.100),
"distance_rocket_propellant": (-0.85704, 0.100),
"power_off_drag": (1, 0.033),
"power_on_drag": (1, 0.033),
"nose_length": (0.610, 0.001),
"nose_distance_to_cm": (0.71971, 0.100),
"fin_span": (0.165, 0.001),
"fin_root_chord": (0.152, 0.001),
"fin_tip_chord": (0.0762, 0.001),
"fin_distance_to_cm": (-1.04956, 0.100),
"transition_top_radius": (203 / 2000, 0.010),
"transition_bottom_radius": (155 / 2000, 0.010),
"transition_length": (0.127, 0.010),
"transition_distance_to_cm": (-1.194656, 0.010),
# launch and environment details
"wind_direction": (0, 3),
"wind_speed": (1, 0.30),
"inclination": (90, 1),
"heading": (181, 3),
"rail_length": (3.353, 0.001),
# parachute details
"cd_s_drogue": (1.5 * np.pi * (24 * 25.4 / 1000) * (24 * 25.4 / 1000) / 4, 0.1),
"cd_s_main": (2.2 * np.pi * (120 * 25.4 / 1000) * (120 * 25.4 / 1000) / 4, 0.1),
"lag_rec": (1, 0.5),
}
# Environment conditions
env = Environment(
gravity=9.81,
latitude=41.775447,
longitude=-86.572467,
date=(2020, 2, 23, 16),
elevation=206,
)
> env.set_atmospheric_model(
type="Reanalysis",
file=env_file,
dictionary="ECMWF",
)
tests\acceptance\test_ndrt_2020_rocket.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
rocketpy\environment\environment.py:1275: in set_atmospheric_model
self.process_forecast_reanalysis(dataset, dictionary)
rocketpy\environment\environment.py:1915: in process_forecast_reanalysis
self.atmospheric_model_interval = get_interval_date_from_time_array(time_array)
rocketpy\environment\tools.py:435: in get_interval_date_from_time_array
return netCDF4.num2date(
src\\cftime\\_cftime.pyx:630: in cftime._cftime.num2date
???
src\\cftime\\_cftime.pyx:474: in cftime._cftime.decode_date_from_scalar
???
.venv\Lib\site-packages\numpy\ma\core.py:4317: in __radd__
return add(other, self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numpy.ma.core._MaskedBinaryOperation object at 0x00000284DAF55130>
a = cftime.DatetimeGregorian(1970, 1, 1, 0, 0, 0, 0, has_year_zero=False)
b = masked_array(data=--,
mask=True,
fill_value=np.str_('?'),
dtype=object)
args = (), kwargs = {}
da = array(cftime.DatetimeGregorian(1970, 1, 1, 0, 0, 0, 0, has_year_zero=False),
dtype=object)
db = array(datetime.timedelta(0), dtype=object)
result = cftime.DatetimeGregorian(1970, 1, 1, 0, 0, 0, 0, has_year_zero=False)
ma = np.False_, mb = array(True), m = np.True_
def __call__(self, a, b, *args, **kwargs):
"""
Execute the call behavior.
"""
# Get the data, as ndarray
(da, db) = (getdata(a), getdata(b))
# Get the result
with np.errstate():
np.seterr(divide='ignore', invalid='ignore')
result = self.f(da, db, *args, **kwargs)
# Get the mask for the result
(ma, mb) = (getmask(a), getmask(b))
if ma is nomask:
if mb is nomask:
m = nomask
else:
m = umath.logical_or(getmaskarray(a), mb)
elif mb is nomask:
m = umath.logical_or(ma, getmaskarray(b))
else:
m = umath.logical_or(ma, mb)
# Case 1. : scalar
> if not result.ndim:
E AttributeError: 'cftime._cftime.DatetimeGregorian' object has no attribute 'ndim'
.venv\Lib\site-packages\numpy\ma\core.py:1068: AttributeError