In other research project descriptions, we have made use of a clear-sky model for insolation. This provides
a way to make various kinds of comparisons between observed insolation under actual sky conditions compared to what
the insolation would be if there were no clouds at all. One interesting research problem is to derive a relationship
between measured insolation and "cloudiness." Then, given some measure of cloud cover, one could predict the insolation in
some statistical sense.
Conversely, given the insolation, one could know something about the cloud cover.
It is sometimes the case that looking at older research papers through more modern eyes can provide an interesting starting
point for research, and that might be the case for
this project. A 1977 paper by R. K. Reed gave an empirical relationship between the ratio of observed insolation to clear-sky
insolation over open ocean as a function of cloud cover and solar elevation angle:
SElev = 1353s•(0.61 + 0.20s)
S/SElev = 1 – 0.62C + 0.0019Elevnoon
where s is the sine of the solar elevation at a particular time where C is the cloud cover in tenths
and Elevnoon is the solar elevation angle at solar noon.
Comparisons with other equations relating insolation to cloud cover are also presented in Reed's paper:
Kimball (1928) S/SElev = 1 – 0.71C Berliand (1960), cited in Kondratyev (1969) S/SElev = 1 – aC + 0.38C2
a varies with latitudeLaevastu (1960) S/SElev = 1 – 0.60C3
Tabata (1964) S/SElev = 1 – 0.716C + 0.00252Elev
The interesting thing about this old paper is that it was written before sophisticated computing capabilities
were available to everyone. How can we make use of these capabilities? One obvious advantage is that we can
very quickly calculate the solar elevation angle anytime, anywhere. More importantly, we may be able to use image processing
software to obtain a value that is related to cloud cover.
The lefthand image below is a photo of a partly cloudy sky, saved as a bitmap (.bmp) image. The righthand
image is that same image resaved as a two-color (black or white) bitmap file, using the popular freeware image
processing program IrfanView. We no longer have to estimate cloud cover in tenths, based on human
observations. Instead, it remains only to count the black and white pixels in this image and calculate the ratio
of white pixels to the total number of pixels.
Original color image. Image reduced to two-color black and white file.
IrfanView will be consistent when it decides what
should be counted as a white or black pixel, using criteria built into the software, but how it does that
and the implications of the decisions it makes are not clear.
For the example shown above, with cumulus clouds against a clear blue sky, the conversion seems entirely
reasonable. For other sky conditions, including lightly or heavily overcast skies, or
cirrus clouds, IrfanView's performance can be more puzzling!
The lefthand image below is an overcast sky, taken just after 4:00 pm local time, and the righthand image is IrfanView's conversion
to a two-color black/white file. Note that the "darker" part of the sky is now classified as white and the "lighter" part as black!
This is a puzzling outcome that deserves further investigation based on a series of sky images! But in any case, the black/white separation
is probably meaningless for the righthand image because the sky is overcast.
Original color image. Image reduced to two-color black and white file.
Writing software to count black and white pixels in a .bmp image requires knowledge of the structure of .bmp files. Fortunately,
the structure of these files is relatively simple. If you search online for "bitmap file format" you will find many references.
Also, there is a reference below to a web page I wrote some years ago. Although image files aren't "text" files, they can nevertheless be treated
like a long string of bytes to be read as "characters" and interpreted one at a time.
The beginning of a .bmp file contains information about the image and these "header" records
are followed by image data. Two-color (black/white) .bmp files are small compared to color files. A full-color .bmp image
requires three bytes (24 bits) for each pixel, but each pixel in a black/white file requires only 1/8 of a byte — 1 bit —
per image pixel. If
a bit is a 1, then the pixel is black. If it is 0, then the pixel is white.
Here's another possible approach to analyzing sky images using ImageJ image processing software (a free download from the National Institutes of Health).
Starting with the original color images, use the Image-->Color-->Split tool to separate the image into three separate images for the red, green,
and blue channels. (All colors are defined by the "intensity" of the red, green, and blue values in each pixel.) Clear blue sky
is nearly black in the red image, but lightly to moderately overcast skies have higher values in all three channels. For a heavily overcast dark
sky, the average value in all three channels will go down.
Once you have separated the colors, you can apply ImageJ's Analyze-->Histogram tool to the red channel as a way to separate clear sky and clouds.
Although it might not be immediately obvious what to do with these histograms (you can save the values in a text file), it is certainly
clear that overcast skies look completely different from partly cloudy skies with cumulus!
Two sky images processed with ImageJ's Split and Histogram tools.
It is also interesting to note that there may be information contained in the brigtness of a clear sky. This
brightness should be a function of atmospheric
conditions and sun angle. Under the same sun conditions, a very clean sky (deep blue) will have a lower average pixel value than a hazier sky.
Here is ImageJ processing of two sky images (not taken under the same sun conditons). Remember that the histogram is
a "grayscale" brightness – the average of the RGB values – for the pixels inside the rectanglular area selected.
(You can select circular or irregularly shaped areas, too.)
Histograms for clear sky under two different conditions, inside selected area.
Reed, R. K. On Estimating Insolation over the Ocean. Journal of Physical Oceanography, Vol. 2, 482-485, May 2007.
Download IrfanView software.
Download NIH ImageJ software.
How to interpret .bmp file formats (with C source code).
PHP script for counting black and white pixels in a .bmp image.