Fortran get_command_argument

Fortran 2003 is a major extension to Fortran 90/95 including many useful features, one significant feature is access to command arguments; this allows a program to take data from the execution command line and use this arguments as input information.

program cmdline
  implicit none

  character(len=*), parameter :: version = '1.0'
  character(len=32) :: arg
  integer :: i

  do i = 1, command_argument_count()
     call get_command_argument(i, arg)

     select case (arg)
     case ('-v', '--version')
        print '(2a)', 'cmdline version ', version
        stop
     case ('-h', '--help')
        call print_help()
        stop
     case default
        print '(a,a,/)', 'Unrecognized command-line option: ', arg
        call print_help()
        stop
     end select
  end do

contains

  subroutine print_help()
    print '(a)', 'usage: cmdline [OPTIONS]'
    print '(a)', 'cmdline options:'
    print '(a)', '  -v, --version     print version information and exit'
    print '(a)', '  -h, --help        print usage information and exit'
  end subroutine print_help

end program cmdline
Advertisements

Plot

The ability to generate high quality scientific graphics for data analysis, showing resumed contents, manipulated data and calculations is an art. For this is critical to have powerful and easy to use tools, my favorite is Plot for Mac. It costs a little to learn how to use it at first but quickly the results can be amazing.

It is free and very recommended.

http://plot.micw.eu/

Download from AppStore: 

 

Dislin

In my last year of college I started working in solar energy research, processing large amounts of data of global, diffuse and direct solar radiation. The processing of this information was very difficult, considering that a year of measurements means more than 500,000 data measured every minute. For each data had to calculate the position of the sun and do quality control of measurements, it was impossible to do it in Excel due to long processing times and freezes. It was then that I began to process information with Fortran, everything was much faster, did not fall and was able to process lots of information quickly. The problem was that was not possible to generate graphics and that was critical for me.

This is how I reach DISLIN, a library to generate incredible graphics from Fortran, very easy to use and export to all formats. With the time I even use Dislin to generate Graphics Users Interface (GUI) for Fortran software.

Below are images with more than 200,000 points that was realized in a couple of seconds with Fortran and DISLIN.

NREL Solar Prospector

The National Renewable Energy Laboratory of United States (NREL) has done an amazing job developing the Solar Prospector, a tool to navigate through data derived from satellite imagery with a resolution of 10×10 km. This mapping tool is designed to help developers site large-scale solar plants by providing easy access to solar resource datasets and other data relevant to utility-scale solar power projects.

Unfortunately the information is only for United States.

Solar Prospector

Rotating Shadowband Radionometer (RSR)

Rotating Shadowband Radionometer (RSR) are a cheap and precise way to measure the solar energy resource (global, diffuse and direct radiation) with a silicon photodiode radiometer and a shadow band.

This system was developed by Dr. Edward Kern, MIT professor who I personally met few years ago, who founded in 2003 Irradiance, Inc. the company which manufacture the Rotating Shadowband Radionometers (RSR2).

Rotating Shadowband Radionometer (RSR2)

Rotating Shadowband Radionometer (RSR2),Image from Irradiance

The Irradiance RSR2 head unit uses a rotating curved band and a single, fast-response, photodiode sensor to measure global and diffuse sunlight. Direct sunlight is calculated by Irradiance’s computer program onboard the Campbell Scientific data logger. It includes a head unit, motor controller, temperature/relative humidity sensor, data logger, PV/battery power supply, cellular modem for remote data access, and stable, light-weight tripod. Continue reading

Atmospheric Attenuation of Solar Radiation

Solar radiation received at the surface of the earth in a clear sky day is subject to variations due to change in the extraterrestrial radiation and to two additional and more significant phenomena:

  • Atmospheric scattering by air molecules, water and dust
  • Atmospheric absorption by O3, H2O and CO2

Scattering of radiation as it passes through the atmosphere is caused by interaction of the radiation with air molecules, water as vapor and droplets, and dust. Scattered photons (mostly at short wavelengths) produce the diffuse sky radiation. The degree to wich scattering occurs is a function of the number of particles through which the radiation must pass and the size of the particles relative to the wavelength of the radiation. The pathlength of the radiation through air molecules is described by the air mass.

Absorption of radiation in the atmosphere in the solar energy spectrum is due largely to ozone in the ultraviolet and to water vapor and carbon dioxide in bands in the infrared. There is almost complete absorption of short-wave radiation by ozone in the upper atmosphere at wavelengths below 290 nm and water vapor absorbs strongly in bands in the infrared part of the solar spectrum, with strong absorbtion bands centered at 1000, 1400 and 1800 nm. Beyond 2500 nm, the transmission of the atmosphere is very low due to absorption by H2O and CO2.

The remaining unabsorbed and unscattered photons, constitute the direct beam radiation. The total radiation flux on a horizontal surface in the presence of diffuse and beam radiation is called “global” radiation.

Figure: Normally incident solar spectrum at sea level on a clear day. The dotted curve shows the extrarrestrial spectrum.