diff --git a/setup.py b/setup.py index aadd1e6..fb5aafe 100644 --- a/setup.py +++ b/setup.py @@ -15,9 +15,16 @@ with io.open(op.join(here, "requirements.txt"), encoding="utf-8") as f: all_reqs = f.read().split("\n") +with io.open(op.join(here, "requirements_dev.txt"), encoding="utf-8") as f: + dev_reqs = [x.strip() for x in f.read().split("\n")] + install_requires = [x.strip() for x in all_reqs if "git+" not in x] dependency_links = [x.strip().replace("git+", "") for x in all_reqs if "git+" not in x] +extras_requires = { + "all": dev_reqs +} + requirements = [ ] setup_requirements = [ ] @@ -39,6 +46,7 @@ ], description="Evapotranspiration (ET) models for use in python and with integration into Google Earth Engine.", install_requires=install_requires, + extras_require=extras_requires, dependency_links=dependency_links, license="MIT license", long_description=readme, diff --git a/tests/test_geeet.py b/tests/test_geeet.py index 4d349fe..f032224 100644 --- a/tests/test_geeet.py +++ b/tests/test_geeet.py @@ -4,7 +4,7 @@ import unittest -#import xarray as xr +import xarray as xr from geeet import geeet @@ -42,19 +42,19 @@ def setUp(self): **{key:np.array(value) for key,value in self.tseb_series_inputs.items()}, **self.tseb_series_inputs_scalar ) - #self.tseb_series_inputs_xr=xr.merge([ - # xr.DataArray(self.tseb_series_inputs["Alb"]).rename("albedo"), - # xr.DataArray(self.tseb_series_inputs["NDVI"]).rename("NDVI"), - # xr.DataArray(self.tseb_series_inputs["Tr"]).rename("radiometric_temperature"), - # xr.DataArray(self.tseb_series_inputs["Ta"]).rename("air_temperature"), - # xr.DataArray(self.tseb_series_inputs["P"]).rename("surface_pressure"), - # xr.DataArray(self.tseb_series_inputs["U"]).rename("wind_speed"), - # xr.DataArray(self.tseb_series_inputs["Sdn"]).rename("solar_radiation"), - # xr.DataArray(self.tseb_series_inputs["Ldn"]).rename("thermal_radiation"), - # ]) - #self.tseb_series_xr = geeet.tseb.tseb_series( - # self.tseb_series_inputs_xr, **self.tseb_series_inputs_scalar - #) + self.tseb_series_inputs_xr=xr.merge([ + xr.DataArray(self.tseb_series_inputs["Alb"]).rename("albedo"), + xr.DataArray(self.tseb_series_inputs["NDVI"]).rename("NDVI"), + xr.DataArray(self.tseb_series_inputs["Tr"]).rename("radiometric_temperature"), + xr.DataArray(self.tseb_series_inputs["Ta"]).rename("air_temperature"), + xr.DataArray(self.tseb_series_inputs["P"]).rename("surface_pressure"), + xr.DataArray(self.tseb_series_inputs["U"]).rename("wind_speed"), + xr.DataArray(self.tseb_series_inputs["Sdn"]).rename("solar_radiation"), + xr.DataArray(self.tseb_series_inputs["Ldn"]).rename("thermal_radiation"), + ]) + self.tseb_series_xr = geeet.tseb.tseb_series( + self.tseb_series_inputs_xr, **self.tseb_series_inputs_scalar + ) def tearDown(self): """Tear down test fixtures, if any.""" @@ -110,29 +110,29 @@ def test_tseb_series_np_energy_balance(self): 10 ) - #def test_tseb_series_xr_consistency(self): - # """Test tseb_series outputs consistency (xr.DataArray).""" - # residuals = self.tseb_series_xr.assign( - # LEr = lambda x: x.LE-x.LEc-x.LEs, - # Rnr = lambda x: x.Rn-x.Rnc-x.Rns - # ) - # self.assertListAlmostEqual( - # residuals.LEr.values, - # [0,0], 10 - # ) - # self.assertListAlmostEqual( - # residuals.Rnr.values, - # [0,0], 10 - # ) - - #def test_tseb_series_xr_energy_balance(self): - # """Test tseb_series energy balance (xr.DataArray).""" - # self.assertListAlmostEqual( - # self.tseb_series_xr.assign( - # EB = lambda x: x.Rn-x.LEc-x.LEs-x.G-x.Hc-x.Hs, - # ).EB.values, - # [0,0], 10 - # ) + def test_tseb_series_xr_consistency(self): + """Test tseb_series outputs consistency (xr.DataArray).""" + residuals = self.tseb_series_xr.assign( + LEr = lambda x: x.LE-x.LEc-x.LEs, + Rnr = lambda x: x.Rn-x.Rnc-x.Rns + ) + self.assertListAlmostEqual( + residuals.LEr.values, + [0,0], 10 + ) + self.assertListAlmostEqual( + residuals.Rnr.values, + [0,0], 10 + ) + + def test_tseb_series_xr_energy_balance(self): + """Test tseb_series energy balance (xr.DataArray).""" + self.assertListAlmostEqual( + self.tseb_series_xr.assign( + EB = lambda x: x.Rn-x.LEc-x.LEs-x.G-x.Hc-x.Hs, + ).EB.values, + [0,0], 10 + ) if __name__ == "__main__": unittest.main() \ No newline at end of file