act.utils.add_solar_variable#

act.utils.add_solar_variable(ds, latitude=None, longitude=None, solar_angle=0.0, dawn_dusk=False)[source]#

Add variable to the dataset to denote night (0) or sun (1). If dawk_dusk is True will also return dawn (2) and dusk (3). If at a high latitude and there’s sun, will label twilight as dawn; if dark{2}, will label twilight as dusk(3).

Parameters:
  • ds (xarray.Dataset) – ACT Xarray dataset

  • latitude (str) – Latitude variable name, default will look for matching variables in the dataset.

  • longitude (str) – Longitude variable name, default will look for matching variables in the dataset.

  • solar_angle (float) – Number of degress to use for dawn/dusk calculations

  • dawn_dusk (boolean) – If set to True, will add values 2 (dawn) and 3 (dusk) to the solar variable

Returns:

ds (xarray.Dataset) – Xarray dataset containing sun and night flag.