diff --git a/schedview/app/scheduler_dashboard/scheduler_dashboard.py b/schedview/app/scheduler_dashboard/scheduler_dashboard.py index 659456d2..b92cb162 100644 --- a/schedview/app/scheduler_dashboard/scheduler_dashboard.py +++ b/schedview/app/scheduler_dashboard/scheduler_dashboard.py @@ -34,6 +34,7 @@ import numpy as np import panel as pn import param +import rubin_sim.site_models from astropy.time import Time from bokeh.models import ColorBar, LinearColorMapper from bokeh.models.widgets.tables import BooleanFormatter, HTMLTemplateFormatter @@ -568,14 +569,23 @@ def update_conditions(self): not hasattr(self, "_model_observatory") or self._model_observatory.nside != self._scheduler.nside ): + # Get weather conditions from pickle. + wind_data = rubin_sim.site_models.ConstantWindData( + wind_speed=self._conditions.wind_speed, + wind_direction=self._conditions.wind_direction, + ) + # Set seeing to fiducial site seeing. + seeing_data = rubin_sim.site_models.ConstantSeeingData(0.69) + # Create new MO instance. self._model_observatory = ModelObservatory( nside=self._scheduler.nside, init_load_length=1, + wind_data=wind_data, + seeing_data=seeing_data, ) self._model_observatory.mjd = self._mjd self._conditions = self._model_observatory.return_conditions() - self._scheduler.update_conditions(self._conditions) self._debugging_message = "Finished updating Conditions object." diff --git a/tests/test_scheduler_dashboard.py b/tests/test_scheduler_dashboard.py index 31821518..50538145 100644 --- a/tests/test_scheduler_dashboard.py +++ b/tests/test_scheduler_dashboard.py @@ -8,6 +8,7 @@ import bokeh.io import bokeh.plotting import pandas as pd +import rubin_sim.site_models from astropy.time import Time from pandas import Timestamp from panel.widgets import Tabulator @@ -131,6 +132,21 @@ def test_compute_survey_maps(self): self.assertIn("reward", survey_maps) self.assertIn("g_sky", survey_maps) + def test_site_models(self): + wind_speed = 4 + wind_direction = 25 + fiducial_seeing = 0.69 + wind_data = rubin_sim.site_models.ConstantWindData( + wind_speed=wind_speed, + wind_direction=wind_direction, + ) + seeing_data = rubin_sim.site_models.ConstantSeeingData(fiducial_seeing) + self.assertIsInstance(wind_data, rubin_sim.site_models.ConstantWindData) + self.assertIsInstance(seeing_data, rubin_sim.site_models.ConstantSeeingData) + self.assertEqual(wind_data.wind_speed, wind_speed) + self.assertEqual(wind_data.wind_direction, wind_direction) + self.assertEqual(seeing_data.fwhm_500, fiducial_seeing) + if __name__ == "__main__": unittest.main()