Changeset 18714 for trunk/FACT++/scripts
- Timestamp:
- 01/06/17 11:58:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/scripts/Observation_class.js
r18430 r18714 20 20 if (isNaN(utc.valueOf())) 21 21 throw new Error('"'+obj.date+'" not a valid Date... try something like "2013-01-08 23:05 UTC".'); 22 22 23 ret.start = utc; 23 24 ret.id = obj.id; … … 68 69 case 'DATA': 69 70 if (i!=obj.measurements.length-1) 70 throw new Error(" DATA [n="+i+", "+utc.toUTCString()+"] must be the last in the list of measurements [cnt="+obj.measurements.length+"]");71 throw new Error("Measurement DATA [n="+i+", "+utc.toUTCString()+"] must be the last in the list of measurements [cnt="+obj.measurements.length+"]"); 71 72 if (ret[i].source == undefined) 72 throw new Error("Observation must have either 'source' or 'task' " + 73 "if 'task' == 'data' it must have also have 'source' "); 74 if (ret[i].lidclosed == true) 75 throw new Error("Observation must not have 'lidclosed'== true " + 76 "if 'task' == 'data' "); 73 throw new Error("Measurement DATA must have a source defined"); 74 // This is obsolete. We cannot check everything which is not evaluated anyways 75 //if (ret[i].lidclosed == true) 76 // throw new Error("Observation must not have 'lidclosed'==true " + 77 // "if 'task'=='data'"); 78 break; 79 80 case 'SUSPEND': 81 case 'RESUME': 82 if (obj.measurements.length!=1) 83 throw new Error("Measurement "+ret[i].task+" [n="+i+", "+utc.toUTCString()+"] must be the only measurements [cnt="+obj.measurements.length+"] in an observation"); 77 84 break; 78 85 79 86 case 'STARTUP': 80 if (ret[i].source != undefined)81 console.out("warning. Observation with task='startup' also has source defined");82 break;83 84 87 case 'SHUTDOWN': 85 88 if (ret[i].source != undefined) 86 console.out(" warning. Observation with task='shutdown' also hassource defined");89 console.out("WARNING - Measurement "+ret[i].task+" has a source defined"); 87 90 break; 88 91 89 92 case 'RATESCAN': 90 93 if (ret[i].source == undefined && (isNaN(ret[i].ra) || isNaN(ret[i].dec))) 91 throw new Error("Observation must have either 'source' or 'ra' & 'dec' " + 92 "if 'task' == 'ratescan'"); 93 if (ret[i].lidclosed == true) 94 throw new Error("Observation must not have 'lidclosed'== true " + 95 "if 'task' == 'ratescan' "); 94 throw new Error("Measurement RATESCAN must have either a source or 'ra' & 'dec' defined"); 95 // This is obsolete. We cannot check everything which is not evaluated anyways 96 //if (ret[i].lidclosed == true) 97 // throw new Error("Observation RATESCAN must not have 'lidclosed'==true"); 96 98 break; 97 99 98 100 case 'RATESCAN2': 99 101 if ((ret[i].lidclosed != true) && ret[i].source == undefined && (isNaN(ret[i].ra) || isNaN(ret[i].dec))) 100 throw new Error("Observation must have either 'source' or 'ra' & 'dec' " + 101 "if 'task' == 'ratescan2' and lidclosed==false or not given"); 102 throw new Error("Measurement RATESCAN2 ('lidclosed'==false or undefined) must have either a source or 'ra' & 'dec' defined"); 102 103 if (ret[i].lidclosed == true && (isNaN(ret[i].az) || isNaN(ret[i].az))) 103 throw new Error("Observation must have 'zd' & 'az' " + 104 "if 'task' == 'ratescan2' and option 'lidclosed'=='true'"); 104 throw new Error("Measurement RATESCAN2 ('lidclosed'==true) must have 'zd' & 'az' defined"); 105 105 break; 106 106 107 107 case 'CUSTOM': 108 109 108 if (isNaN(ret[i].az) || isNaN(ret[i].az) || isNaN(ret[i].time) || isNaN(ret[i].threshold)) 110 throw new Error("Observation must have 'zd' & 'az', 'time' and 'threshold' " + 111 "if 'task' == 'custom' "); 109 throw new Error("Measurement CUSTOM must have 'zd' & 'az', 'time' and 'threshold' defined."); 112 110 break; 113 111 … … 120 118 121 119 default: 122 throw new Error("The observationtype "+ret[i].task+" is unknown.");120 throw new Error("The measurement type "+ret[i].task+" is unknown."); 123 121 } 124 122 }
Note:
See TracChangeset
for help on using the changeset viewer.