Sun and radiations

class utils.sun.sun[source]

Bases: object

A class for computation around sun and radiations

coszenith(tab_time_date, lat, lon, slope, aspect)[source]

Cosinus of solar zenith angle (detailed explaination in function slope_aspect_correction)

Take a certain amount of times (Nt) and points (Np described by lat, lon, slope, aspect) and return for each time and point the cosinus of zenith angle of sun (shape Nt, Np).

Parameters:
  • tab_time_date – time values, numpy array of size Nt of python datetime.datetime elements (or other type with timetuple function available)

  • lat – latitude, numpy array (floats), length Np

  • lon – longitude, numpy array (floats), length Np

  • slope – slope (degrees), numpy array (floats), length Np

  • aspect – aspect (degrees), numpy array (floats), length Np

Returns:

Cosinus of zenith angle

Return type:

numpy array of shape (Nt, Np)

directdiffus(SWglo, time, lat, lon, slope, aspect, site)[source]

Separation of direct and diffuse short wave radiations

Parameters:
  • SWglo – global short wave

  • time – time

  • lat – latitude

  • lon – longitude

  • slope – The slope angle (degrees)

  • aspect – The aspect (degrees)

  • site – The site code for clear sky decomposition. Must be one of wfj, snb, swa, sap, sod, rme, oas, obs, ojp or cdp)

Returns:

direct short wave, diffuse short wave

slope_aspect_correction(direct, diffus, time, lat_in, lon_in, aspect_in, slope_in, list_list_azim=None, list_list_mask=None, lnosof_surfex=True, convert_time=True, return_angles=False)[source]

This routine corrects the direct solar radiation because of explicit slope or surrounding masks

Parameters:
  • direct – array of direct solar radiation over an infinite flat surface (time,loc) or (time,x,y)

  • time – time vector

  • latitude – latitude vector

  • logitude – longitude vector

  • aspect – aspect vector

  • slope – slope vector

  • list_list_azim – list of azimuths of masks on each point(radian or degrees ?)

  • list_list_mask – list of heights of masks on each point(radian or degrees ?)

  • lnosof_surfex (bool) – (subgrid orography deactivated in Surfex)

  • convert_time (bool) – take time at the middle of the time step to compute angles more representative of the fluxes

  • return_angles (bool) – if True, also return the sun angle

Returns:

corrected direct solar radiation and optionally, the angular positions of sun