Skip to content
Snippets Groups Projects
Commit 5d242b8f authored by goei's avatar goei
Browse files

TMSS-379 Use correct default station group settings for UC1. Determine station...

TMSS-379 Use correct default station group settings for UC1. Determine station list for subtask with updated station specifications using group and list.
parent 2be0ae9d
No related branches found
No related tags found
2 merge requests!260syncing cob-master with master again,!247Resolve TMSS-379 "Input"
......@@ -62,7 +62,20 @@
},
"antenna_set": "HBA_DUAL_INNER",
"filter": "HBA_110_190",
"stations":["CS001"],
"stations": [
{
"group": "DUTCH",
"max_missing": 4
},
{
"group": "INTERNATIONAL",
"max_missing": 2
},
{
"group": "INTERNATIONAL_REQUIRED",
"max_missing": 1
}
],
"tile_beam": {
"direction_type": "J2000",
"angle1": 0.42,
......
......@@ -89,12 +89,11 @@
"station_constraint":{
"type":"object",
"default":{},
"additionalProperties":false,
"oneOf": [
{
"title":"Custom list",
"properties":{
"stations":{
"list":{
"title":"Stations",
"description": "Custom station selection",
"$ref": "http://tmss.lofar.org/api/schemas/commonschematemplate/stations/1#/definitions/station_list",
......@@ -105,7 +104,7 @@
"default":0
}
},
"required":[ "stations", "max_missing" ]
"required":[ "list", "max_missing" ]
}, {
"title": "All",
"properties":{
......@@ -205,7 +204,7 @@
"minItems":1,
"default": [ {
"group": "ALL",
"stations": [],
"list": [],
"max_missing": 0
} ]
},
......
......@@ -8,7 +8,7 @@
"properties": {
"stations": {
"$ref": "http://tmss.lofar.org/api/schemas/commonschematemplate/stations/1#/definitions/stations",
"default": ["CS001"]
"default": [ {} ]
},
"antenna_set": {
"$ref": "http://tmss.lofar.org/api/schemas/commonschematemplate/stations/1/#/definitions/antenna_set",
......
......@@ -129,16 +129,25 @@ def create_observation_subtask_specifications_from_observation_task_blueprint(ta
subtask_spec['stations']["filter"] = task_spec["filter"]
if "stations" in task_spec:
if "group" in task_spec["stations"]:
try:
# retrieve stations in group from RADB virtual instrument
station_group_name = task_spec["stations"]["group"]
subtask_spec['stations']['station_list'] = get_stations_in_group(station_group_name)
except Exception as e:
raise SubtaskCreationException("Could not determine stations in group '%s' for task_blueprint id=%s. Error: %s" % (
station_group_name, task_blueprint.id, e))
else:
subtask_spec['stations']['station_list'] = task_spec["stations"]
subtask_station_list = []
# task_spec["stations"] is a list
for station_item in task_spec["stations"]:
if "group" in station_item:
station_group_name = station_item["group"]
try:
# retrieve stations in group from RADB virtual instrument
subtask_station_list.extend(get_stations_in_group(station_group_name))
except Exception as e:
raise SubtaskCreationException("Could not determine stations in group '%s' for task_blueprint id=%s. Error: %s" % (
station_group_name, task_blueprint.id, e))
elif "list" in station_item:
subtask_station_list.extend(station_item["list"])
else:
logger.info("NO 'group' or 'list' in task spec, so nothing to be added to station list")
subtask_spec['stations']['station_list'] = sorted(list(set(subtask_station_list)))
else:
logger.info("NO stations defined at all")
# TODO: Do something with max_missing
if 'calibrator' not in task_blueprint.specifications_template.name.lower():
# copy/convert the analoge/digital_pointings only for non-calibrator observations (the calibrator has its own pointing)
......@@ -173,6 +182,16 @@ def create_observation_subtask_specifications_from_observation_task_blueprint(ta
def get_stations_in_group(station_group_name: str) -> []:
'''Get a list of station names in the given station_group.
A lookup is performed in the RADB, in the virtual instrument table'''
# TODO Make names RA and TMSS spec equal: 'NL' or 'DUTCH'?
if station_group_name == "DUTCH":
station_group_name = "NL"
#International required is by defintion DE601 or DE605, take 601 for now
# TODO check with RA the availability of both stations
if station_group_name == "INTERNATIONAL_REQUIRED":
return ["DE601"]
with RADBRPC.create() as radbrpc:
resource_group_memberships = radbrpc.getResourceGroupMemberships()['groups']
station_resource_group = next(rg for rg in resource_group_memberships.values()
......@@ -184,6 +203,10 @@ def get_stations_in_group(station_group_name: str) -> []:
if 'RS408' in station_names:
station_names.remove('RS408')
# HACK remove TEST1 from station list otherwise validate will fail
if 'TEST1' in station_names:
station_names.remove('TEST1')
return sorted(list(station_names))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment