.. _flags: Flagging the data ============================ To use correcly the data, it is necessary to flag it appropriately. 4 cases can arise: #. The antenna is not working anymore (\ ``flag``\ = 1). #. The transmitter is off (\ ``flag``\ = 2). #. It is nightime (\ ``flag``\ = 3). #. Nothing particular is happening, the data can be used (\ ``flag``\ = 0). .. _flag_antenna_down: Antenna shutdown ---------------------- The first case is the antenna shutting down. First of all, in this case, an email alert can be sent (see :ref:`emails`). This is detected if the number of points in the file being read stays the same. Since for a single station the file is read every minute, there should be around 60 new points. If the antenna has stopped, then the file is still a\ ``.mau``\ file, and it is still the last updated file, ensuring that this method works. .. note:: Because there may be short antenna shutdowns, and since normally the antenna starts again on its own, we choose not to send an alert at each interruption. Instead, an alert is sent after five times reading the files without any new points. .. _flag_tx_off: Transmitter off ---------------------- This situation doesn't really warrant an alert, as transmitters are regularly stopped for maintenance. However, when a transmitter is not transmitting, the amplitude becomes very low and the phase random. The detection script, and all the data analysis will not work in this case, thus the data needs to be flagged. The flagging for this case works by saying that the amplitude is very low (below the antenna sensitivity, which is specified by the :py:attr:`threshold` parameter of the :py:class:`~vlf4ions.class_definition.receiver` class). Because there may be punctual noise, this is checked on the median amplitude recorded for the past minute. Nighttime ---------------------- Nighttime here is defined as either being before the sunrise (civil sunrise + 1 hour) or after sunset (civil sunset - 1 hour). This is checked with the\ ``sunrise_sunset``\ files (see :ref:`additional_files`). Since nighttime doesn't necessitates an alert, all that happens in this case is that the flag is set to 3. Phase not well demodulated --------------------------------- Sometimes the phase doesn't seem to be well demodulated, resulting in apparently random phase variations. This only happens very rarely, and may be due to operator actions at the transmitter site. In this case, the\ ``flag``\ value is set to 2. This is detected by noting jumps of more than 20° between consecutive phase values.