terraref / extractors-hyperspectral

Scripts and code relevant to the SWIR and VNIR cameras.
BSD 3-Clause "New" or "Revised" License
6 stars 6 forks source link

Add Solar Zenith Angle Variable #23

Closed FlyingWithJerome closed 7 years ago

FlyingWithJerome commented 7 years ago

Now the hyperspectral output will have a variable "solar_zenith_angle" with dimension "time" showing as below (by ncks)

...
    double solar_zenith_angle(time) ;
      solar_zenith_angle:units = "degree" ;
      solar_zenith_angle:long_name = "Solar Zenith Angle" ;
      solar_zenith_angle:notes = "The angle of the sun comparing to the vertical axis of the Cartesian Coordinate" ;
...

Since these functions were translated from MATLAB, the result is still not flawless (partially because Python is not an ideal language for calculation, although it has a lot of math libraries).

Here is the result from Python Solar Zenith Angle calculator @ 2016/06/01 in Maricopa field sza python

The angles in the morning are obviously incorrect. The result from Matlab at the same time in Maricopa field (I think this one is correct) untitled

P.S. Please only look at the last commit; rest of the commits are hanging around because another pull request is still waiting to be merged. This PR is in a new branch called "solar_zenith_angle"

FlyingWithJerome commented 7 years ago

@czender The new algorithm from slr_cld.c is better. The graph generated by the Python code is shown below:

sza python_new

The graph above is combined by 10800 discrete points with dt=5s from 5am to 19pm, which are the sunrise and sunset time in Maricopa Area on 06/01.

Comparing to the result from NOAA_Solar_Zenith Angle_Calculator here, noon time is relatively accurate, but the morning time is not that accurate.