diff --git a/config/pyros_observatory/general/schemas/schema_observatory-2.0.yml b/config/pyros_observatory/general/schemas/schema_observatory-2.0.yml index f6dcdac..e3931b2 100644 --- a/config/pyros_observatory/general/schemas/schema_observatory-2.0.yml +++ b/config/pyros_observatory/general/schemas/schema_observatory-2.0.yml @@ -525,6 +525,9 @@ schema;schema_UNIT: home: type: str required: True + duskelev: + type: str + required: True horizon: type: map required: True diff --git a/src/core/pyros_django/majordome/agent/Agent.py b/src/core/pyros_django/majordome/agent/Agent.py index 5b207bf..ec15e2a 100755 --- a/src/core/pyros_django/majordome/agent/Agent.py +++ b/src/core/pyros_django/majordome/agent/Agent.py @@ -154,7 +154,8 @@ import config.old_config as config_old #from config import * from majordome.models import AgentSurvey, AgentCmd, AgentLogs -from user_mgmt.models import Period, Quota +from user_mgmt.models import Period +from scp_mgmt.models import Quota from vendor.guitastro.src.guitastro import Ephemeris import pickle @@ -3551,21 +3552,21 @@ class Agent: # --- Check if durations.pickle file exists rootdir = self._oc['config'].fn.rootdir filename = os.path.join(rootdir, period_id, "durations.pickle") - self.dprint(f"Read {filename=}") + log.info(f"Read {filename=}") if os.path.exists(filename): self._oc['config'].fn.fcontext = fcontext0 return pickle.load(open(filename, "wb")) # --- Get the period limit dates jd1, jd2 - self.dprint(f"{dir(operiod)=}") + log.info(f"{dir(operiod)=}") d = operiod.start_date.isoformat() night_start = d[0:4]+d[5:7]+d[8:10] jd1, _ = self.config.fn.night2date(night_start) d = operiod.end_date.isoformat() night_end = d[0:4]+d[5:7]+d[8:10] jd2, _ = self.config.fn.night2date(night_end) - self.dprint(f"{night_start=} {night_end=}") - self.dprint(f"{jd1=} {jd2=}") + log.info(f"{night_start=} {night_end=}") + log.info(f"{jd1=} {jd2=}") # --- Loop over dates of the period to create ephems targets = ['sun', 'moon'] @@ -3576,10 +3577,11 @@ class Agent: d_cur = 0 d_total = 0 night_info = {} + self._duskelev = self.config.getDuskElev() while jd < jd2: night = self._oc['config'].fn.date2night(jd) for target in targets: - self.dprint(f"{night=} {target=}") + log.info(f"{night=} {target=}") ephem = self.ephem_target2night(target, jd) if target == "sun": ks = np.where(ephem['alt'] < self._duskelev) diff --git a/src/core/pyros_django/obs_config/obsconfig_class.py b/src/core/pyros_django/obs_config/obsconfig_class.py index a768b3d..f59557e 100644 --- a/src/core/pyros_django/obs_config/obsconfig_class.py +++ b/src/core/pyros_django/obs_config/obsconfig_class.py @@ -1239,6 +1239,16 @@ class OBSConfig: """ home = self.get_unit_by_name(self.unit_name).get("home") return home + + def getDuskElev(self)->float: + """ + Return duskelev of current unit + + Returns: + float: string reprensenting duskelev of unit + """ + duskelev = float(self.get_unit_by_name(self.unit_name).get("duskelev")) + return duskelev def get_agent_path_data_root(self, agent_name:str, computer_hostname=None) -> str: """ -- libgit2 0.21.2