From ce4ce3e630936a6ce8ee2ad1a659ad9733e79b52 Mon Sep 17 00:00:00 2001 From: pyros_astroguita Date: Fri, 20 Oct 2023 17:19:41 +0200 Subject: [PATCH] add duskelev & dawn --- config/pyros_observatory/general/schemas/schema_observatory-2.0.yml | 7 +++++-- src/core/pyros_django/obs_config/obsconfig_class.py | 21 +++++++++++++++++---- src/core/pyros_django/seq_submit/validators.py | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) 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 d0569d3..b95b9d7 100644 --- a/config/pyros_observatory/general/schemas/schema_observatory-2.0.yml +++ b/config/pyros_observatory/general/schemas/schema_observatory-2.0.yml @@ -539,8 +539,11 @@ schema;schema_UNIT: home: type: str required: True - duskelev: - type: str + dusk_elev: + type: any + required: True + dawn_elev: + type: any required: True horizon: type: map diff --git a/src/core/pyros_django/obs_config/obsconfig_class.py b/src/core/pyros_django/obs_config/obsconfig_class.py index f59557e..c66a235 100644 --- a/src/core/pyros_django/obs_config/obsconfig_class.py +++ b/src/core/pyros_django/obs_config/obsconfig_class.py @@ -10,6 +10,8 @@ import socket from datetime import datetime from pykwalify.errors import PyKwalifyException, SchemaError from pathlib import Path +import ast + sys.path.append(os.environ.get("PROJECT_ROOT_PATH", os.path.join(os.getcwd(),"../../../../"))) from vendor.guitastro.src.guitastro import FileNames, Home @@ -1242,13 +1244,24 @@ class OBSConfig: def getDuskElev(self)->float: """ - Return duskelev of current unit + Return dusk_elev of current unit Returns: - float: string reprensenting duskelev of unit + Tuple: string reprensenting dusk_elev of unit + """ + dusk_elev = ast.literal_eval(self.get_unit_by_name(self.unit_name).get("dusk_elev")) + return dusk_elev + + def getDawnElev(self)->float: """ - duskelev = float(self.get_unit_by_name(self.unit_name).get("duskelev")) - return duskelev + Return dawn_elev of current unit + + Returns: + Tuple: string reprensenting dusk_elev of unit + """ + dawn_elev = ast.literal_eval(self.get_unit_by_name(self.unit_name).get("dawn_elev")) + return dawn_elev + def get_agent_path_data_root(self, agent_name:str, computer_hostname=None) -> str: """ diff --git a/src/core/pyros_django/seq_submit/validators.py b/src/core/pyros_django/seq_submit/validators.py index 57b5c84..bb642b9 100644 --- a/src/core/pyros_django/seq_submit/validators.py +++ b/src/core/pyros_django/seq_submit/validators.py @@ -109,7 +109,7 @@ def check_sequence_validity(seq): guitastro_home = guitastro.Home(home) fn.longitude = guitastro_home.longitude seq.night_id = fn.get_night(seq.start_date.isoformat()[:19]) - duskelev = -7 + _, duskelev = config.getDuskElev() try: # TODO remplacer les none par les fichiers pickle de ephem_sun & ephem_moon # On a besoin de calculer la visibilité de l'objet donc il faut l'ephemeride -- libgit2 0.21.2