def ncar_humidity_data(grid: 'GridDimensions' = GridDimensions((10, 20)), year: int = None) -> np.array: """ A data provider returning (by default) 1-degree gridded relative humidity data at surface level. The data will be adjusted to a new grid if one is provided. Data is returned as a nested list structure. The outermost list has 12 indices, and represents months of the year. For instance, index 0 represents January, and index 9 is October. The second index is latitude, and the third is longitude. The data will default to a 1-by-1-degree grid, but can be converted to other grid dimensions through the two function parameters. Only grids containing integer multiples of the original grid are supported. :param grid: The dimensions of the grid onto which the data will be converted :return: NCEP/NCAR surface relative humidity data """ dataset = custom_readers.NCEPReader('water') humidity = dataset.collect_timed_layered_data('rhum', year) # Regrid the humidity variable to the specified grid, if necessary. regridded_humidity = _regrid_netcdf_variable(humidity, grid, 4) grid_by_count = grid.dims_by_count() top_atm_shape = (humidity.shape[0], 5, grid_by_count[0], grid_by_count[1]) high_layer_humidity = np.zeros(top_atm_shape) regridded_humidity = np.hstack((regridded_humidity, high_layer_humidity)) return regridded_humidity
def ncar_pressure_levels() -> np.array: """ :param grid: :type grid: :param year: :type year: :return: :rtype: """ dataset = custom_readers.NCEPReader('temperature') return dataset.pressure()
def ncar_temperature_data(grid: 'GridDimensions' = GridDimensions((10, 20)), year: int = None) -> np.array: """ :param grid: :type grid: :param year: :type year: :return: :rtype: """ dataset = custom_readers.NCEPReader('temperature') temp = dataset.collect_timed_layered_data('air', year) # Regrid the humidity variable to the specified grid, if necessary. regridded_temp = _regrid_netcdf_variable(temp, grid, 4) ground_temp = regridded_temp[:, 0, ...] ground_temp = ground_temp[:, np.newaxis, ...] regridded_temp = np.hstack((ground_temp, regridded_temp)) return regridded_temp