nsrdb.albedo.temperature_model.DataHandler

class DataHandler[source]

Bases: object

DataHandler for MERRA data used in albedo computations

Methods

get_data(date, merra_path, mask, lat, lon[, ...])

Get temperature data from MERRA

get_grid(lat, lon, mask)

Get grid from composite albedo day instance

static get_grid(lat, lon, mask)[source]

Get grid from composite albedo day instance

Parameters:
  • lat (ndarray) – array of latitudes for modis grid

  • lon (ndarray) – array of longitudes for modis grid

  • mask (ndarray) – snow_no_snow mask with 1 for snowy cells and 0 for clear cells

Returns:

pd.DataFrame – dataframe with latitudes and longitudes for grid

static get_data(date, merra_path, mask, lat, lon, avg=True, fp_out=None, max_workers=None, n_chunks=64)[source]

Get temperature data from MERRA

Parameters:
  • date (datetime.datetime) – date for which to get temperature data

  • merra_path (str) – path to merra temperature data

  • mask (ndarray) – snow_no_snow mask with 1 for snowy cells and 0 for clear cells

  • lat (ndarray) – array of latitudes for modis grid

  • lon (ndarray) – array of longitudes for modis grid

  • max_workers (int | None) – maximum number of workers for loading MERRA data

  • n_chunks (int) – number of chunks to split full grid into for parallel data loading

Returns:

ndarray (lat, lon) – temperature data array on lat/lon grid