sup3r.bias.bias_calc_vortex.VortexMeanPrepper#
- class VortexMeanPrepper(path_pattern, in_heights, out_heights, overwrite=False)[source]#
Bases:
object
Class for converting monthly vortex tif files for each height to a single h5 files containing all monthly means for all requested output heights.
- Parameters:
path_pattern (str) – Pattern for input tif files. Needs to include {month} and {height} format keys.
in_heights (list) – List of heights for input files.
out_heights (list) – List of output heights used for interpolation
overwrite (bool) – Whether to overwrite intermediate netcdf files containing the interpolated masked monthly means.
Methods
Write netcdf files for all heights for all months.
convert_month_height_tif
(month, height)Get windspeed mean for the given month and hub height from the corresponding input file and write this to a netcdf file.
convert_month_tif
(month)Write netcdf files for all heights for the given month.
Get interpolated monthly means for all out heights as a dictionary to use for h5 writing.
get_height_files
(month)Get set of netcdf files for given month
get_input_file
(month, height)Get vortex tif file for given month and height.
Get lat lon grid
get_month
(month)Get interpolated means for all hub heights for the given month.
get_output_file
(month)Get name of netcdf file for a given month.
interp
(data)Interpolate data to requested output heights.
run
(path_pattern, in_heights, out_heights, ...)Read vortex tif files, convert these to monthly netcdf files for all input heights, interpolate this data to requested output heights, mask fill values, and write all data to h5 file.
write_data
(fp_out, out)Write monthly means for all heights to h5 file
Attributes
Get dictionary on how this data is prepared
List of features corresponding to input heights.
Get list of all input files used for h5 meta.
Mask coordinates without data
Get meta with latitude/longitude
List of features corresponding to output heights
List of output monthly output files each with windspeed for all input heights
Get time index so output conforms to standard format
- property in_features#
List of features corresponding to input heights.
- property out_features#
List of features corresponding to output heights
- property input_files#
Get list of all input files used for h5 meta.
- property output_files#
List of output monthly output files each with windspeed for all input heights
- convert_month_height_tif(month, height)[source]#
Get windspeed mean for the given month and hub height from the corresponding input file and write this to a netcdf file.
- property mask#
Mask coordinates without data
- get_month(month)[source]#
Get interpolated means for all hub heights for the given month.
- Parameters:
month (str) – Name of month to get data for
- Returns:
data (xarray.Dataset) – xarray dataset object containing interpolated monthly windspeed means for all input and output heights
- interp(data)[source]#
Interpolate data to requested output heights.
- Parameters:
data (xarray.Dataset) – xarray dataset object containing windspeed for all input heights
- Returns:
data (xarray.Dataset) – xarray dataset object containing windspeed for all input and output heights
- property meta#
Get meta with latitude/longitude
- property time_index#
Get time index so output conforms to standard format
- get_all_data()[source]#
Get interpolated monthly means for all out heights as a dictionary to use for h5 writing.
- Returns:
out (dict) – Dictionary of arrays containing monthly means for each hub height. Also includes latitude and longitude. Spatial dimensions are flattened
- property global_attrs#
Get dictionary on how this data is prepared
- classmethod run(path_pattern, in_heights, out_heights, fp_out, overwrite=False)[source]#
Read vortex tif files, convert these to monthly netcdf files for all input heights, interpolate this data to requested output heights, mask fill values, and write all data to h5 file.
- Parameters:
path_pattern (str) – Pattern for input tif files. Needs to include {month} and {height} format keys.
in_heights (list) – List of heights for input files.
out_heights (list) – List of output heights used for interpolation
fp_out (str) – Name of final h5 output file to write with means.
overwrite (bool) – Whether to overwrite intermediate netcdf files containing the interpolated masked monthly means.