Orbiting space objects have become in the last decade a major nuisance impacting ground astronomy and orbiting space assets from observatories to satellites and space stations. In particular with the rise of the satellite population in Low Earth Orbits space objects are becoming an even bigger threat and a strong problem to astronomical observations. To tackle these threats several coordinated surveillance networks composed of dedicated sensors telescopes radars and laser ranging facilities track and survey space objects from debris to active satellites. As part of the European Space Surveillance amp Tracking network Portugal is developing the Pampilhosa da Serra Space Observatory with both radio and optical telescopes dedicated to the Space Situational Awareness domain deployed at a Dark Sky destination. To optimize telescope survey time we developed CLOud Watcher at Night CLOWN an application interface that automatically monitors clouds in real time. This software can correctly trace cloud positions in the sky and provide accurate pointing information to the observation planning of the optical telescope to avoid cloudy areas. CLOWN only requires the use of an allsky camera which is already a norm in observatories with optical telescopes and can be used with any camera including those for which no information about its model specification do exist. CLOWN does not require great computing power and it does not require the installation of additional equipment. CLOWN results are very promising and confirm that the app can correctly identify clouds in a variety of different conditions and cloud types.
['Space debris', 'All-sky cameras', "Earth's clouds", 'Automated telescopes', 'Optical observatories', 'Surveys', 'Sky surveys', 'Observational astronomy', 'Astronomical techniques', '1542', '25', '258', '121', '1170', '1671', '1464', '1145', '1684', 'Astrophysics - Instrumentation and Methods for Astrophysics', 'Astrophysics - Cosmology and Nongalactic Astrophysics', 'Astrophysics - Earth and Planetary Astrophysics', 'Astrophysics - High Energy Astrophysical Phenomena', 'Physics - Instrumentation and Detectors']
CLOWN The PASO Cloud Detection for Optimization of Automatic Optical Surveys
{'CLOWN : The PASO cloud detection for optimization of automatic optical surveys.': "<!-- image -->  \n1  \nCFisUC, Departamento de F'ısica, Universidade de Coimbra, 3004-516 Coimbra, Portugal 2 ATLAR Innovation, Ed. Multiusos, Rua Rangel de Lima, 3320-229 Pampilhosa da Serra, Portugal 3 Instituto de Telecomunica¸c˜oes, Universidade de Aveiro, Campus Universit'ario de Santiago, 3810-193 Aveiro, Portugal 4 CICGE, Faculdade de Ciˆencias da Universidade do Porto, 4169-007 Porto, Portugal  \n5 Departamento de F'ısica, Universidade de Aveiro, Research Centre on Didactics and Technology in the Education of Trainers (CIDTFF), Campus Universit'ario de Santiago, 3810-193 Aveiro, Portugal", 'ABSTRACT': "Orbiting space objects have become in the last decade a major nuisance impacting ground astronomy and orbiting space assets, from observatories to satellites and space stations. In particular with the rise of the satellite population in Low Earth Orbits (LEOs), space objects are becoming an even bigger threat and a strong problem to astronomical observations. To tackle these threats several coordinated surveillance networks composed of dedicated sensors (telescopes, radars and laser ranging facilities) track and survey space objects, from debris to active satellites. As part of the European Space Surveillance & Tracking (EU-SST) network, Portugal is developing the PAmpilhosa da Serra Space Observatory (PASO), with both radio and optical telescopes dedicated to the Space Situational Awareness (SSA) domain, deployed at a Dark Sky destination. To optimize telescope survey time, we developed CLOWN (CLOud Watcher at Night), an application interface that automatically monitors clouds in real time. This software can correctly trace clouds positions in the sky, provides accurate pointing information to the observation planning of the optical telescope to avoid cloudy areas. CLOWN only requires the use of an all-sky camera, which is already a norm in observatories with optical telescopes and can be used with any camera, including those for which no information about its model specification do exist. CLOWN does not require great computing power and it does not require the installation of additional equipment. CLOWN results are very promising and confirm that the app can correctly identify clouds in a variety of different conditions and cloud types.  \nKeywords: Space Debris (1542) - All-sky cameras (25) - Earth's clouds(258) - Automated telescopes(121) - Optical observatories(1170) - Surveys(1671) - Sky surveys (1464) Observational astronomy(1145) - Astronomical techniques(1684)", '1. INTRODUCTION': "The last few decades have seen an explosion in space exploration, with a rapid increase in the number of satellite launches, with several private companies creating their mega-constellations with an expected number topping more than ∼ 42000 satellites (Zhang et al. 2022). As we write, there are over 6000 satellites including more than 5000 constellations satellites in orbit (Mc Dowell 2023; UNOOSA 2022; UCS 2022), and these numbers are expected to dramatically increase in the next decade. The continuous accumulation of satellites and associated space debris in orbit over time is today a major concern (McNally & Rast 1999; Rossi 2005). Even small debris can greatly damage an active satellite due to their high speeds ( ∼ 28000 km/h). With the rising number of objects the risk of collisions increases which will in turn create even more debris, creating a cascade effect known as 'Kessler Syndrome' (Kessler & Cour-Palais 1978) that may deeply affect the orbital space around the Planet.  \nOf particular concern to astronomy, planned LEO satellite mega-constellations and the associated space debris field reflect light from the sun and are visible from optical to infrared and their beacons and passive Radio frequency reflections from ground emitters are detected by ground detectors as well. This orbital presence constitutes a threat to the dark and quiet skies and will have negative impacts on astronomy with wider societal impacts. These concerns  \nhave motivated the creation of the International Astronomical Union (IAU) Centre for the Protection of the Dark and Quiet Sky from Satellite Constellation Interference (IAU CPS) (Barentine & Heim 2023) to address the effects of this ever-growing satellite population and propose mitigation measures and reduce impacts on astronomical surveys.  \nAs advocated by the IAU CPS 1 , the dark and quiet sky is an essential requirement to facilitate fundamental research and technology development, programmatic observations for key priorities included in the SSA domain like planetary defence, and is essential for basic services like space navigation and geolocation. As a major example of the current impacts of mega-constellations on astronomical facilities, the Vera C. Rubin Observatory, a large optical telescope with a wide field of view scheduled to commence operations in 2024 whose main task will be the production of the world's largest synoptic astronomical survey, the Legacy Survey of Space and Time (Ivezi'c et al. 2019) that will have up to 30% of its images at the beginning and end of each night (Williams et al. 2021), the night moments when LEOs are brighter, impacted by one or more satellite streaks from the almost 42,000 planned SpaceX satellite constellation.  \nIndeed, as shown above, LEO constellations may compromise the effectiveness of astronomical infrastructure and will likely impact national and international investments in astronomy. Adding to this, the rise of space debris in particular in LEO orbits poses a direct threat to space assets.  \nThis enormous and rising number of space objects has led to the development and world deployment of automated networks to detect these debris, verify orbital occupancy, improve space object orbital parameter determination, and provide alert services. This should evolve soon towards a Space Traffic Management system that may include collision avoidance, fragmentation detection, and Earth reentrance services and database management. Major space-faring nations developed their own SSA/SST programs, notably the US with the Spacetrack 2 network (Vallado et al. 2006; Bulmann et al. 1974), China (Du 2017), India (Prasad 2005; Adimurthy & Ganeshan 2006), Russia (as an update and follow-up of the previous Soviet network), Brazil (Froehlich et al. 2020; Nogueira et al. 2012) and more recently Europe with the European Space Surveillance and Tracking 3 (EU-SST). These expanding SSA ground sensor networks are proof of the great investments in this area (Tingay et al. 2013; Jiang et al. 2022) and besides their regional priorities they constitute an important source of relevant information on objects affecting astronomical observations.", '1.1. The PASO optical telescopes': "As part of the Space Surveillance & Tracking - Portugal (SST-PT), a node to the EU-SST, the Pampilhosa da Serra Space Observatory (PASO) hosts the rAdio TeLescope pAmpilhosa Serra (ATLAS), a monostatic radar tracking sensor currently in test phase (Pandeirada et al. 2021), a wide field of view telescope for GEO space surveillance operated under the auspices of the Portuguese MoD (PT-MoD) and a double telescope system (Coelho et al. 2021), installed in the Summer of 2022, and currently in integration. PASO is developed within the Dark Sky 'Aldeias do Xisto' Tourism destination, a dark sky area certified by the Starlight Foundation and thus guarantees low levels of light pollution and good sky background ( ≥ 21.1 mag/arcsec 2 ) and at least 50% of clear nights per year. The combined operation of radar and optical sensors takes advantage of radar measurements which give precise radial velocity and distance to the objects, while the telescope gives better sky coordinates measurements. With the installation of radar and optical sensors, PASO can extend the observation time of space mega-constellations and space debris and correlate information from optical and radar provenances in real-time. During twilight periods both sensors can be used simultaneously to rapidly compute new orbits for LEO objects, eliminating the time delays involved in data exchange between sites in a large SST network. This concept will not replace the need for an SSA/SST network with sensors in multiple locations around the globe but will provide a more complete set of measurements from a given object passage, and therefore increase the added value for initial orbit determination, or monitoring of reentry campaigns at a given location. PASO will contribute to the development of new solutions to better characterize the objects improving the overall SST capabilities and constitute a perfect site for the development and testing of new radar and optical data fusion algorithms and techniques for space debris monitoring.  \nThe PASO double telescope system can observe a maximum FoV of 4.3 · × 2 . 3 · . It is equipped with B, V, R, I, H α and [OIII] filters that allow the acquisition of light curves in different wavelengths (up to two simultaneously). Its main goal will be to automatically track objects in Low Earth Orbits (LEO) in particular at dawn and before sunset but it will also have the capability to track and survey objects in Medium Earth Orbit (MEO) and Geosynchronous Orbit (GEO) when not observing LEOs. Besides its SSA operational duties, the WFOV twin telescope will be used  \nNotes:  \n- *A PT-MoD, Instituto de Telecomunica¸c˜oes and University of Coimbra partnership.\n- † Telescope property of PT-MoD, operating within the EU-SST network.  \nAn SST observational planning will consider the position and phase of the moon, the position of the Milky Way, the shadow of the earth, and meteorological conditions to improve the quality of data and protect the equipment from damage. Cloudy weather impacts the availability and efficiency of the optical telescopes when used automatically by compromising the captured data. LEO satellites are only visible for a fraction of the night (at dawn and dusk essentially), and are blocked for most of the night by the Earth's shadow. The optical telescope operation needs to be optimized to avoid cloudy patches and avoid losing any observation and image processing time. To maximize the system efficiency and availability, we designed an automatic and real-time cloud detection system to support the operation of the optical telescopes. The proposed solution aims to keep costs down, making use of equipment (an all-sky camera) already present in any typical observatory. This solution is easy to deploy in any observatory with telescopes preforming automated observation, either the ones operating for SSA or the ones dedicated to astronomical duties (eg. DES Dark Energy Survey Collaboration et al. (2016); Vera C. Rubin LSST Blum et al. (2022); Pan-STARRS Tonry (2013); J-PAS, J-PLUS, S-PLUS Ben'ıtez et al. (2015), Cenarro et al. (2019), Mendes de Oliveira et al. (2019)).", '2. CLOWN : CLOUD WATCHER AT NIGHT': 'CLOWN : CLOud Watcher at Night, is a software developed to detect clouds obscuration on all-sky images, and optimize astronomical or space surveys. Although it was developed to increase survey time for SSA purposes it can be used as an ancillary tool to optimize astronomical large sky area surveys and streamline telescope pointing decisions. Apart from increasing the availability of optical surveys, it can also be used for other goals such as study the presence of clouds in the region either for meteorological reasons or to analyze the applicability of that location for an optical telescope. The provided in real time cloud maps may also constitute a valuable tool for the operation of optical communication ground stations. For instance the number of cloudless nights is an important parameter for Dark Sky astrotourism certifications. The complete operation flowchart of the software is presented in figure 1. The algorithm was developed using the programming language Python and it is available on GitHub 4 and on Zenodo (Pino Gon¸calves 2024).  \nThe automatic cloud detection pipeline has to deal with the fact that clouds may be brighter or darker than the apparent sky background. The brighter clouds may result from ground artificial light reflections or produced by the dispersion of light emitted by a bright sky source like the Moon; hence they will be referred as visible. On the other hand, the clouds darker than the sky background are referred here as invisible. Cloud detection is based on the assumption of the presence or absence of stars in the image since their positions are well known from star catalogs. This enables the detection of both visible and invisible clouds as in both cases they will block the stars from appearing in the image.', '2.1. All-sky images': "An All-Sky camera observes the entire sky above it via a fish-eye lens and takes images with a large FoV up to 2 π steradians. There are different types of the fish-eye lens using different projections (or curved deformation). The image fits into the sensor with usually four main projections: stereographical, equidistant, equisolid angle, and orthographic.  \nfor transient science or to monitor variable sources in the sky like Andromeda Novae (Darnley et al. 2019; Aydi et al. 2022; Chomiuk et al. 2022). The system is being prepared to operate with minimum to none human intervention while it maximizes observational time and optimizes the data processing pipeline procedures.  \nTable 1. PASO optical SSA instruments.  \nFigure 1. Basic flow diagram of the CLOWN pipeline.  \n<!-- image -->  \nAlthough each projection has its own special properties and applications the equidistant projection is the most suited for our purposes since it creates a linear relation between the distance to the center of the image and the corresponding angular coordinates (Fleck 1995).  \nThe camera available at PASO is the Occulus All-Sky Camera 180 · (Occulus 2021), with camera information in Table 2. Its sensor has a 1392 × 1040 pixel resolution, with a pixel size of 4.65 µ m and a fish-eye lens of focal length f = 1.55 mm enabling an equidistant image projection. The camera is equipped with a policarbonate dome to protect the lens from the environment and an heating system to avoid condensation. These features make it ideal for sky monitoring and provide ancillary pointing information to the telescope operators during the entire night. The images have 30 seconds of time exposure, enabling the observation of Hipparcos catalog Perryman et al. (1997) stars up to 6.5 magnitude across the entire FoV. For our PASO FoV, this results in over 2000 stars on average per image. This is enough to analyze the entire sky hemisphere with enough precision for the operation of the WFOV double telescope system at PASO.  \nTable 2. All-sky cameras parameters (Occulus (2021))  \nWe use AllSkEye (Poelzl 2021), a freely available app, to capture the all-sky images. Although the camera is shipped with its custom-made photo acquisition software, it still needs to be reset daily and may not comply with the high availability requirements set by an SSA or astronomical network. For this reason, the camera shipped software was not considered the best choice for an automated system requiring a longer operation time. AllSkEye suite provides a large integrated set of options that facilitate this goal: i) it allows for automatic photo capture between sunset and sunrise  \nwith a controlled time for each photo; ii) it has an inbuilt protection decision loop against high-intensity illumination to avoid damaging the camera's sensor; iii) it enables the use of a horizon mask to remove constant obstacles in the camera field of view including uneven horizon masks for tree lines, tall buildings, etc. The output file can be saved in both FITS or jpeg files. Most importantly, this software also has the major benefit of being agnostic to most camera models and thus can be used in any observatory with an already custom-installed camera.  \nMost observatories with optical telescopes have all-sky cameras but their characteristics may be unknown if they are older models. To confirm the potential of CLOWN with a generic all-sky camera, we also tested the software using images from the All-sky Camera II of the 'Observat'orio do Pico dos Dias' (OPD) in Bras'opolis, Brazil, on which we have no technical information on the camera model specifications . These images are made publicly available by the Laborat'orio Nacional de Astrof'ısica at (LNA 2022), with a refreshing rate of one image/minute. This camera has a 640 × 480 pixel resolution, and it captures images with a 60-second exposure time.", '2.2. Star Detection': "The first step is to perform the source extraction. Stars in an all-sky image will be bright sources or blobs spread within a dark background, creating a large contrast in their locations. Identification of blob-like structures through contrast enhancement (CE) methods of image processing include non-linear transformations (Peli 1990; Beghdadi & Le Negrate 1989; Gonzalez & Wood 2008), histogram-based techniques (Pizer et al. 1990; Pisano et al. 1998; Tsai & Yeh 2008), contrast-tone optimization (Zhao 2010), frequency domain methods (Kingsbury 1999; Loza et al. 2013; Nafornita & Isar 2014; Isar et al. 2011). Among the most used methods in digital processing, contrast detection in still images has been pursued using the Sobel, Prewitt or Roberts operators (Chaple et al. 2015). The examples given here are tools used for contrast detection that are very useful for vertical and horizontal edge detection. But additional analysis would be needed since our goal is detect the blobs centers. Although we did not pursue extensive method comparisons through the previously identified techniques, we verified the Laplacian of Gaussian or LoG method (Marr & Hildreth 1980) is also used for contrast detection but it is also sensitive to blob-like structures and that is why it is the method of choice for the blob detection application, regardless of the field of study. The Laplacian is a 2-D isotropic measure of the 2nd spatial derivative of an image and therefore sensitive to regions of rapid intensity change and often used for edge detection. Natural noise variations present in every image dataset are smoothed via a Gaussian blurring step, which improves sensitivity to blob-like structures. It also creates another advantage for blob detection as the response will be sensible to the blob radius, maximum when the blob is close to √ 2 σ , where σ is the standard deviation set for the Gaussian blurring step. This property allows the study of blob-like structures' size. By using the associative property of the convolution operation, these two steps can be applied simultaneously in a single convolution filter significantly decreasing the computational cost.  \nOur algorithm follows the blob log method from the scikit-image package (van der Walt et al. 2014). This applies the LoG filter to the image and outputs the position and size of the detected objects. The LoG filter accepts several parameters to optimize results; of those, there are four who are most important which are: min σ , max σ , num σ , and the threshold. The first two parameters control the minimum and maximum σ values used for the Gaussian filter respectively and the third controls the number of points within the σ range. Since for our application we are not interested in analyzing in detail the size of the blobs, after some testing we reduced the value of num σ as much as possible to decrease the computational cost.  \nThe LoG method enables the study of the blob size, so we were able to determine the commonest σ values in our image. We found that the smaller objects detected had a σ ≃ 1 and the largest σ ≃ 1 . 5, and that is why we chose those values for our variables. With these values all detections were correctly identified so we decided to keep num σ = 2 to decrease the computational cost. These values for max σ and min σ were confirmed after checking the LoG's property enabling the study the size of the blobs. These values may slightly change for different camera models but should be constant over time with reasonable meteorological conditions. The last important parameter is the threshold for a positive spike to be considered a detection. Choosing a very low value might detect all blobs but end up with a large number of false positives, whereas if the value is too big, the method fails to detect a large number of objects leading to false negatives. Therefore we prefer to produce a few additional false positives that can be easily removed in the posterior iterations of the algorithm, finding after testing that a threshold of 0.013 provides a good result. We let these parameters free in the configuration file to enable easier control.  \nFigure 2 (left) shows the results after the application of our LoG method to an all-sky image from PASO. The objects are correctly identified throughout the image. The presence of an uneven horizon with obstacles such as  \nbuildings or trees leads to a number of false detections which contributes to slowing down the algorithm execution. To eliminate false detections and reduce the computational cost we created a mask image of the horizon profile around the observatory in black-and-white for sharper edge detection - where white is the area of interest. With this mask, we can remove all detections in low-elevation areas that are not important to our observational operations. Besides the manual creation of a mask, a minimum sky elevation can also be specified in the configuration file as a user requirement. The mask created for the PASO all-sky camera is presented in Figure 2 (right). After the first horizon determination, the resulting mask was edited with a general purpose image editing tool (such as GIMP), a relatively quick process that only needs to be done once. Codes such as the Simulating Horizon Angle Profile from Elevation Sets (SHAPES) Bassett et al. (2021) 5 that were developed to automatically create a mask for low radio frequency global 21-cm experiments using Google maps information were not thought to be required to our needs but could also be used at the expense of a more complex procedure and computation time.  \n<!-- image -->  \nFigure 2. Left image: an example of the sources detected in CLOWN is displayed by green circles in an all-sky image from PASO. Right image: the mask created for the PASO all-sky camera (area of interest in white) to eliminate false detections on the horizon. A small area with several detections can be seen on the left image, which is caused by a glint caused by an illumination lamp in the area. It can be ignored because it is a small area in the sky. If the glint becomes persistent it can be resolved by including this zone in the mask or even better by physically remove that light source.  \n<!-- image -->", '2.3. Star Matching': "The algorithm's second step proceeds to a comparison of the objects found to those in a catalog such as the Hipparcos 2000 (Perryman et al. 1997). This catalog has enough objects in the range of magnitudes of interest for the application (118322 stars). For the comparison between the detected stars and the stars in the catalog, we filtered the objects in the catalog to a magnitude less than or equal to 5.5, as those were the ones that consistently showed up in our images. For higher magnitudes, the number of false negatives increases significantly as can be seen in figure 3. On average, we had over 2000 stars per image. To compare the detected objects with the catalog, we used the astropy library (Astropy Collaboration et al. 2013, 2018). We found that in the case of a big cloud illuminated by the moon, the code treated the cloud as a very large set of small objects and did not identify any stars in the non-cloudy region. To avoid this code ill-decision we implemented a pre-condition assuming that for a very high number of detections (much bigger than expected by comparing to the catalog) it would assume that the detections were due to the clouds and instantaneously draws the clouds edges based on the detected points instead of comparing them with the catalog.  \nFor the comparison, we transform the coordinates of our image pixels (x,y) to match the coordinates of the catalog stars (Ra,Dec), or vice-versa. The transformation from celestial coordinates (Ra,Dec) to horizontal coordinates  \nFigure 3. Relation between number of missing stars and their magnitude.  \n<!-- image -->  \n(Alt,Az) is easily performed through the astropy library (Astropy Collaboration et al. 2013, 2018). In detail, we first transform the pixel coordinates in the image into polar coordinates using the center of the image as the origin, as seen in figure 4. After checking the alignment (meaning the North is perfectly vertical in the image and the zenith is exactly the center of the image) the value of θ will be equal to the azimuth. In most cases, there will be a fixed offset that can easily be corrected. With the value of r from the polar coordinates, we can use the corresponding camera transformation to obtain the corresponding angle ϕ , which will be the zenith distance (Alt= 90 -ϕ ).  \n<!-- image -->  \nFigure 4. Illustration of the polar coordinate transformation. Left image: the image pixel coordinate system (x,y) is drawn on the top left in white, and the polar coordinates system for a perfect camera installation is overlaid in red. On the right image, we have the polar coordinate system for the real system, obtained after correction for the fixed angle offset.  \n<!-- image -->  \nFor a perfect camera installation, the center pixel of the image should coincide with the zenith. Since in real conditions this may not be the case we need to find the zenith pixel and the related coordinate offsets with the following steps : i) the algorithm finds the brightest stars in the image, analyzes all the image across various values of r , and records both their (Alt,Az) and (x,y) coordinate pairs; ii) it then compares the found coordinates to Stellarium(Zotti et al. 2021) database to check the (Alt,Az) coordinates of each star; iii) it calculates the zenith pixel coordinates and the angular offset to the North pixel to minimize the error in the coordinate system transformation [(x,y) → (Alt,Az)].  \nFor an application to other cameras without known model specifications (like focal distance, pixel size, and projection type), we assume by default a linear transformation (equidistant) for the image processing. In this case, it is easier to estimate the ratio between the number of pixels in the image and the corresponding angle as we know that either the width, height, or diagonal will correspond to 180 · . This transformation also has the advantage of creating an intermediary relation r θ when compared with the other projections, enabling it to be applied more generally. In the case of the OPD camera we estimated that the number of pixels corresponding to the width of the image will approximately correspond to 180 · .  \nUsing this transformation assumption we obtained a median error of 0.42 · for the Alt/Az coordinates with the PASO camera and a 0.61 · median error with the OPD camera. Of course, a good knowledge of the camera model properties leads to smaller errors in the determination of the star's coordinates. But we checked that even with an unknown camera model, the results are sufficiently good for our application to enable good perator decisions.  \nStill, it might just be the case that the OPD camera has also an equidistant projection. We tried but were unable to find examples of all-sky cameras that provided their camera specifications of projections other than the equidistant. We could also not obtain a different all-sky camera for ourselves, and test on-site. So to confirm our assumptions, we checked how well these projections could be approximated by a linear function (see figure 5). For all the listed projections, we can immediately notice that the error increases rapidly for higher projection angles (in the stereographical projection the error may surpass 2% for angles higher than 80 · ).  \nFigure 5. Different projections and respective linear approximations (left) and the percentage error (right).  \n<!-- image -->  \nAlthough for the stereographical and equisolid case the error is below the 2% mark, with the ortographical case the error is higher. Fortunately, this last projection seems to be much less common as a default camera parameter. If the operator still wishes to consider the ortographical projection it can choose to overfit to the lower projection angles up a defined analysis threshold. Another option is to estimate iteratively the projection values using the ZenithPhaseCalculator.py coupled with the graphical tool, but this is not an automated procedure.", '2.4. Cloud Mask': "The resulting cloud mask is saved as a binary image to remove ambiguities in the creation of an user threshold for what would be designed as an 'acceptable cloudiness' level. To produce a cloud mask a white blob is superposed on every missing star in the image. The blobs size was calculated by dividing the useful area of the image by the number of objects detected in the image. The overlap of these star blobs produces the final shape of the clouds. Although it was implemented to be an automated procedure, the size of the blobs can still be a free parameter controlled manually  \nafter an operator decision. Although we developed CLOWN to be an automated procedure for our case study, it can be operated in a more manual control. In this case, the operator must be careful to avoid wrong cloud detections due to false positives. To correct for false positives and disable the software to wrongly block areas of clear sky, a local binarization procedure is also applied. For each pixel, the sum of the neighborhood pixels was compared with a threshold value. In our assumption, a cloud would block a large number of stars in the same area, and so if a star is the only one in that area, it may be considered a false-positive and removed. We tested this procedure by checking the values for the neighborhood size (in number of pixels) and the threshold value can be defined by the user in the configuration file. In figure 6, figure 7, and in figure 8 one can see examples of cloud masks obtained in different cloud conditions, as observed by the all-sky camera at PASO, and on figure 9 we can see an example using the OPD all-sky camera.  \n<!-- image -->  \nFigure 6. Visible cloud detected with our all-sky image from PASO (left) and corresponding cloud mask obtained with CLOWN (right).  \n<!-- image -->  \n<!-- image -->  \nFigure 7. Invisible cloud detected with our all-sky image from PASO (left) and corresponding cloud mask obtained with CLOWN (right). The telescope would still operate on these conditions, as it does not reach 75% blocked sky.  \n<!-- image -->", '2.5. Running CLOWN as a service': 'The optical telescopes will execute every day a previously planned mission for the entire night (see example in figure 10). As seen in the example image, if the telescope operation starts from the image left side, it will acquire corrupted data due to cloud blocking, wasting survey time and causing processing hurdles. However, CLOWN immediately detects the presence of clouds in that region and skips until it finds a clear-sky region. This operation increases the survey efficiency of the telescope in particular for space debris surveillance operations that require the acquisition of hundreds of images all night and thus avoid observation time lost as much as possible. CLOWN enables a quick reaction and if cloud conditions change later, the telescopes can return to the area that was skipped beforehand and recover sky coverage as seen in figure 10 (right).  \n<!-- image -->  \nFigure 8. Clear sky image obtained with our all-sky image from PASO (left) and corresponding cloud mask obtained with CLOWN (right).  \n<!-- image -->  \n<!-- image -->  \nFigure 9. All-sky image taken from the OPD with cloudy conditions LNA (2022) (left) and corresponding cloud mask obtained with CLOWN (right).  \n<!-- image -->  \n<!-- image -->  \nFigure 10. In these images we can see a theoretical planned one night survey in the optical telescope where the rectangles indicate the observing areas of 6.9 · × 6 . 9 · corresponding to the telescope FoV of 2.3 · × 2 . 3 · plus 1 FoV of margin. Yellow and dark blue boundaries reveal areas with and without clouds, respectively. This information is then passed onto the telescope enabling it point to a cloudless area. Right and left images show the change in cloud conditions within a five minute interval.  \n<!-- image -->  \nThis program can also be used to guide user manual operation if required as it can correlate Ra/Dec coordinates to pixels in the image providing an easier visualization of the clear night sky for the operator. After CLOWN installation 6  \nwe can check the two built-in examples with OPD and PASO files to enable program testing and careful integration within an observatory control environment. The three CLOWN executables ( CLOWN.py , CheckPoint.py and ZenithPhaseCalculator.py ) run in the CLOWN directory according to the flowchart described in figure 1 and do follow a Python command line approach:  \nCLOWN.py: corresponds to the core program, creating a cloud mask from an image. This tool assumes that all-sky images are correctly stored in the specified Images folder path indicated in the configuration file. This enables CLOWN to be used on a larger system controlling multiple all-sky cameras with different configuration files on different locations remotely at the same time. If the GRAPH option is enabled in the configuration file, a visual representation is done for every image with the star distribution (found and not found stars) as shown in figure 11. This tool follows a Python command line approach or a dashboard widget: python3 CLOWN.py config file  \nCheckPoint.py: It checks the existence of clouds blocking for either one (Ra,Dec) coordinate pair or a list of (Ra,Dec) coordinate pairs in a specific cloud mask and can be run as shown below respectively. In the CheckPoint tool, there is also a visual representation for easy understanding as shown in figure 12. This can be disabled in the GRAPH parameter in the configuration file.  \npython3 CheckPoint.py config file MaskPath Ra Dec  \npython3 CheckPoint.py config file MaskPath RaDecFile  \nZenithPhaseCalculator.py: The ZenithPhaseCalculator.py calculates the phase and zenith corrections as explained in section 2.3 and can be run as shown below. The AltAzFile and XYFile contain the corresponding coordinates for several stars in the image field, which can also be obtained with a general-purpose astronomy software like Stellarium. The Area parameter controls the area around the center to search for the zenith. This tool also has visual assistance as shown in figure 13.  \npython3 ZenithPhaseCalculator.py AltAzFile XYFile Area', '2.6. Results': "CLOWN was extensively tested with many acquired images in different cloud conditions. The software showed its pipeline can detect the presence of clouds with precision and provide a cloud monitoring service to astronomical operation. We presented examples of the results obtained for various types of cloud conditions (visible clouds in figure 6, invisible clouds in figure 7, and no clouds in figure 8). CLOWN was also able to analyze images without known camera model specifications as can be seen in figure 9 - an image obtained by the all-sky camera located at OPD, Brazil. The existence of 'holes' in the mask is not an issue as they are smaller than the telescope FoV (2.3 · × 2 . 3 · ) we are considering. In every tested mask, there were several 'clouds' near the horizon (below 30 degrees of altitude), which for the application purposes was not considered a problem, since near horizon areas are not of interest to our main observation cases. For images with more than 75% of the sky blocked by clouds, the telescope would automatically shut the dome to protect the equipment from potential damage. CLOWN is also very effective to produce cloud maps of very bright clouds illuminated by the Moon, which would normally cause a large number of false detections.", '3. CONCLUSION': "CLOWN is a new open-source tool to optimize large sky area survey observations meant specially for SSA monitoring and in our case for surveys targeting LEO mega-constellations and space-debris surveys. CLOWN was developed as an observatory tool coupled to the PASO optical telescopes. The code is freely available at GitHub. CLOWN can also be used as a 'Cloud Watch as a Service' to increase the efficiency of active survey missions other than space debris: it can monitor, in real-time and automatically, the position of clouds in the entire sky which enables the automatic use of an optical telescope even in cloudy conditions.  \n<!-- image -->  \n<!-- image -->  \n<!-- image -->  \nFigure 11. Graphical representation of image (top left), detected objects, expected stars and matched stars (top right), output of first analysis step (bottom left) and final output (bottom right).  \n<!-- image -->  \n<!-- image -->  \nFigure 12. CheckPoint.py illustration: showing the area being checked.  \n<!-- image -->  \nThe program was developed with a low computational cost and applies to any type of all-sky camera even when there is no a priori knowledge of camera specifications, as was tested with the Brazil OPD images. For a well known camera with model specifications available extensive testing shows that CLOWN obtained star coordinates with a median error of 0.42 · ; however, if there is not a priori knowledge of camera model specifications the median error is 0.61 · . Even for cases where the moon illuminates the clouds and negatively affects our images, CLOWN is still robust enough to create a correct cloud mask.  \nFigure 13. ZenithPointCalculator.py illustration. The zenith point is drawn in the center and the coordinates given in the AltAz file are drawn, so the user can visually see if the correspondence is correct or what error might be causing the mismatch.  \n<!-- image -->  \nOur all-sky camera is already installed in PASO and is accessed via a visual assistance dashboard tool enabling automatic and also manual operations.  \nFor future improvements, we plan to explore machine learning tools for cloud detection when a sufficiently high amount of images for algorithm training becomes available. This may produce faster and even better results. The images could also be used for statistical studies on local night cloudy conditions and improve the local monitoring on the number of cloudy nights, an important parameter for certification of Dark Sky astrotourism destinations. Indeed, PASO is located at Aldeias do Xisto Dark Sky Tourism destination certified by the by the Starlight Foundation and the data collected will be of importance for certification procedures and dark sky quality control.  \nImages of our all-sky camera will be made available online in the near future, updated every minute, following the example of LNA (2022).  \nThe team acknowledges support from ENGAGE-SKA Research Infrastructure, ref. POCI-01-0145FEDER-022217 funded by COMPETE 2020 and FCT -Funda¸c˜ao para a Ciˆencia e a Tecnologia, I.P., Portugal; Project Lab. Associado UID/EEA/50008/2019; Project Centro de Investiga¸c˜ao em Ciˆencias Geo-Espaciais, reference UIDB/00190/2020, funded by COMPETE 2020 and FCT, Portugal; project UIDB/00194/2020 ( https://doi.org/10.54499/UIDB/00194/2020 ) and UIDP/00194/2020 ( https://doi.org/10.54499/UIDP/00194/2020 ) funded by FCT, IP., Portugal. The team acknowledges support by the European Space Surveillance & Tracking network, under the grant agreement 2-3SST2018-20 funded by European Commission H2020 Program. The team also thanks Jos'e Silva for improving PASO's all-sky camera assembly. We would like to thank the suggestions and comments from the referee that helped to much improve our manuscript.  \nUsed Softwares : Astropy, AllSkEye, scikit-image, Stellarium", 'REFERENCES': "2022, Observat'orio do Pico dos Dias. http://200.131.64.207/allsky/centralclima.html Adimurthy, V., & Ganeshan, A. 2006, Acta Astronautica, 58, 168,  \ndoi: https://doi.org/10.1016/j.actaastro.2005.09.002  \nAstropy Collaboration, Robitaille, T. P., Tollerud, E. J., et al. 2013, A&A, 558, A33,  \ndoi: 10.1051/0004-6361/201322068  \nAstropy Collaboration, Price-Whelan, A. M., Sip˝ocz, B. M., et al. 2018, AJ, 156, 123, doi: 10.3847/1538-3881/aabc4f  \nRossi, A. 2005, Serbian Astronomical Journal, 170, 1, doi: 10.2298/SAJ0570001R  \n- Tingay, S. J., Kaplan, D. L., McKinley, B., et al. 2013, The Astronomical Journal, 146, 103,  \ndoi: 10.1088/0004-6256/146/4/103  \n- Tonry, J. L. 2013, Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, 371, 20120269, doi: 10.1098/rsta.2012.0269\n- Tsai, C.-M., & Yeh, Z.-M. 2008, IEEE Transactions on Consumer Electronics, 54, 213,  \ndoi: 10.1109/TCE.2008.4560077  \n- UCS. 2022, Satellite Database.  \nhttps://www.ucsusa.org/resources/satellite-database  \n- UNOOSA. 2022, United Nations Office for Outer Space Affairs. https:  \n//www.unoosa.org/oosa/osoindex/index.jspx?lf id=  \nVallado, D., Crawford, P., Hujsak, R., & Kelso, T. 2006, Revisiting Spacetrack Report #3,  \ndoi: 10.2514/6.2006-6753  \nvan der Walt, S., Schonberger, J. L., Nunez-Iglesias, J.,  \net al. 2014, PeerJ, 2, e453, doi: 10.7717/peerj.453  \n- Williams, A., Hainaut, O., Otarola, A., Tan, G. H., & Rotola, G. 2021, The Messenger, 184, 3,  \ndoi: 10.18727/0722-6691/5237  \nZhang, J., Cai, Y., Xue, C., Xue, Z., & Cai, H. 2022, Space:  \nScience and Technology, 2022, 9865174,  \ndoi: 10.34133/2022/9865174  \n- Zhao, Y. 2010, Phd thesis, McMaster University, Ontario, Canada  \nZotti, G., Hoffmann, S. M., Wolf, A., Ch'ereau, F., & Ch'ereau, G. 2021, Journal of Skyscape Archaeology, 6, 221-258, doi: 10.1558/jsa.17822"}