oggm.utils.compute_temp_bias_dataframe#
- oggm.utils.compute_temp_bias_dataframe(glacier_statistics, min_glaciers=12, max_radius=10, err_fill_quantile=0.9, rgi_region=None, rgi_subregion=None, path=None, plot_path=None, summary_path=None)[source]#
Computes the temperature bias prior file out of a temp_melt run.
This is the counterpart of
utils.get_temp_bias_dataframe(): it creates the file which the informed_threestep mass balance calibration reads as a prior (see mb_calibration_from_geodetic_mb).The input is the glacier_statistics file(s) of a preprocessing run made with the temp_melt calibration strategy, i.e. a run in which the melt factor was kept at its default and the temperature bias was chosen so as to match the geodetic observations. This function summarizes these per-glacier temperature biases per climate grid point, using the (weighted) median of all glaciers within the grid point. Grid points with fewer than min_glaciers glaciers are grouped with their neighbours, by growing a square search radius until enough glaciers are found.
The climate grid is reconstructed from the baseline_climate_ref_pix_lon / baseline_climate_ref_pix_lat columns of the statistics file, i.e. the very coordinates the calibration matches against. Note that the resulting lon_id / lat_id columns (and hence the index) are relative to the extent of the data, not absolute indices into the climate file. They are used internally only.
Since the grouping of grid points crosses RGI region borders, this should be applied to the statistics files of all the regions at once.
- Parameters:
- glacier_statisticspandas.DataFrame, str, Path or list
the glacier statistics of a temp_melt run: a DataFrame, or one or more paths to csv files, directories or glob patterns.
- min_glaciersint, default 12
minimum number of glaciers per grid point. Grid points with fewer glaciers are grouped with their neighbours.
- max_radiusint, default 10
the maximum search radius (in grid points) used for the grouping.
- err_fill_quantilefloat, default 0.9
glaciers with a missing (or zero) reference mass balance error are attributed this quantile of the error distribution.
- rgi_regionstr or list, optional
select only these RGI regions (e.g. ‘11’).
- rgi_subregionstr or list, optional
select only these RGI subregions (e.g. ‘11-01’).
- pathstr or Path, optional
where to write the resulting csv file.
- plot_pathstr or Path, optional
base path for the diagnostic plots (without extension). Two files are written: {plot_path}_map.png and {plot_path}_hist.png.
- summary_pathstr or Path, optional
where to write the diagnostic summary (a text file). The same content is sent to the log, but the file is what you will still have after the fact. Recommended!
- Returns:
- a DataFrame with one row per climate grid point.