From 0558c5be24e88d739ae4cb8cf30a5f66db53a0f8 Mon Sep 17 00:00:00 2001 From: Tiago Quintino Date: Mon, 11 Nov 2024 09:16:09 +0000 Subject: [PATCH] Fix #37 normal effective temperature parenthesis --- tests/net.csv | 100 +++++++++++++++++++-------------------- tests/test_scalars.py | 2 +- thermofeel/thermofeel.py | 2 +- 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/tests/net.csv b/tests/net.csv index a42e4e7..7ab9b8b 100644 --- a/tests/net.csv +++ b/tests/net.csv @@ -1,50 +1,50 @@ -3.033889702205782442e+02 -2.928502091976476436e+02 -2.770285138080615752e+02 -2.770490005238265780e+02 -2.770928248276744625e+02 -2.771638191543268022e+02 -2.772180430167822465e+02 -2.773481405053552180e+02 -2.774187263366436014e+02 -2.774623803824222819e+02 -2.775973885081999697e+02 -2.776094978681781527e+02 -2.775812180858250713e+02 -2.775939616382239024e+02 -2.775908341477433510e+02 -2.775773393811281267e+02 -2.775198416488409521e+02 -2.774920248106813006e+02 -2.774635394202203997e+02 -2.773664551403895189e+02 -2.773095070329615623e+02 -2.772699512899097840e+02 -2.772017131727243964e+02 -2.771203280402834821e+02 -2.769705081825984507e+02 -2.769574995185245712e+02 -2.937299618046274645e+02 -2.935924042492049466e+02 -2.933120777011570226e+02 -2.932935807975503053e+02 -2.933526871192943872e+02 -2.936544161860668964e+02 -2.938921675892892722e+02 -2.941795452139757003e+02 -2.947574518545506521e+02 -2.950281071095799916e+02 -2.950420555947761159e+02 -2.948682023918578352e+02 -2.946889368890751939e+02 -2.945812316730967950e+02 -2.945970172400211027e+02 -2.945403954938864217e+02 -2.947040000154167956e+02 -2.947692211015685757e+02 -2.949256961037862652e+02 -2.951105589804234341e+02 -2.949321900709687725e+02 -2.947569560678213065e+02 -2.942588330787240238e+02 -2.942205457588216859e+02 +3.010065622860677763e+02 +2.978004713493879763e+02 +2.762241215897753364e+02 +2.762341286739048769e+02 +2.763012956155728830e+02 +2.764059939851455852e+02 +2.764790654938740317e+02 +2.766273813534896249e+02 +2.766893014126333696e+02 +2.766966993523136011e+02 +2.767887884697527738e+02 +2.767496737064529952e+02 +2.769510933062428535e+02 +2.768837969370093788e+02 +2.768171117155841898e+02 +2.767348212481284122e+02 +2.766230919517424240e+02 +2.765545420051105907e+02 +2.765267374915458731e+02 +2.764466352440045398e+02 +2.764088648567151267e+02 +2.763790656581484200e+02 +2.763100466759992742e+02 +2.762046876422498372e+02 +2.762623057754365163e+02 +2.761689174526972579e+02 +2.911413948240829654e+02 +2.910768702461481325e+02 +2.907986242602605671e+02 +2.907857526147024601e+02 +2.907969231665560415e+02 +2.911296388794274321e+02 +2.914604298204376391e+02 +2.918874048860148491e+02 +2.928703177480205682e+02 +2.936264195426511492e+02 +2.948825390578576844e+02 +2.951751610936696579e+02 +2.953622575333719738e+02 +2.954328487477691283e+02 +2.953756039592274760e+02 +2.949602578417895415e+02 +2.946793060090293466e+02 +2.939725759663496092e+02 +2.934531765165319825e+02 +2.931004552660506874e+02 +2.923946543653016761e+02 +2.918684112352694342e+02 +2.913048255487498182e+02 +2.910969750368326459e+02 diff --git a/tests/test_scalars.py b/tests/test_scalars.py index 1793f52..a1f5eaa 100644 --- a/tests/test_scalars.py +++ b/tests/test_scalars.py @@ -144,7 +144,7 @@ def test_normal_effective_temperature(self): rh = np.array([80]) net = np.array([tmf.calculate_normal_effective_temperature(t2_k, va, rh)]) # print(f"net {net}") - assert net == pytest.approx(314.7102642987715, abs=1e-6) + assert net == pytest.approx(304.13650125, abs=1e-6) def test_apparent_temperature(self): t2_k = np.array([tmf.celsius_to_kelvin(25.0)]) diff --git a/thermofeel/thermofeel.py b/thermofeel/thermofeel.py index a01c5ea..7a976b7 100644 --- a/thermofeel/thermofeel.py +++ b/thermofeel/thermofeel.py @@ -678,7 +678,7 @@ def calculate_normal_effective_temperature(t2_k, va, rh): ditermeq = 1 / (1.76 + 1.4 * v**0.75) net = ( 37 - - (37 - t2_k / (0.68 - 0.0014 * rh + ditermeq)) + - ((37 - t2_k) / (0.68 - 0.0014 * rh + ditermeq)) - 0.29 * t2_k * (1 - 0.01 * rh) ) net_k = celsius_to_kelvin(net)