oggm.GlacierDirectory

class oggm.GlacierDirectory(rgi_entity, base_dir=None, reset=False)

Organizes read and write access to the glacier’s files.

It handles a glacier directory created in a base directory (default is the “per_glacier” folder in the working directory). The role of a GlacierDirectory is to give access to file paths and to I/O operations in a transparent way. The user should not care about where the files are located, but should know their name (see cfg.BASENAMES).

A glacier entity has one or more divides. See Glacier working directories for more information.

__init__(rgi_entity, base_dir=None, reset=False)

Creates a new directory or opens an existing one.

Parameters:

rgi_entity: glacier entity read from the shapefile

base_dir: path to the directory where to open the directory

defaults to “conf.PATHPATHS[‘working_dir’] + /per_glacier/”

reset: emtpy the directory at construction (careful!)

Attributes

dir (str) path to the directory
rgi_id (str) The glacier’s RGI identifier
glims_id (str) The glacier’s GLIMS identifier (when available)
rgi_area_km2 (float) The glacier’s RGI area (km2)
cenlon (float) The glacier’s RGI central longitude
rgi_date (datetime) The RGI’s BGNDATE attribute if available. Otherwise, defaults to 2003-01-01
rgi_region (str) The RGI region name
name (str) The RGI glacier name (if Available)

Methods

__init__(rgi_entity[, base_dir, reset]) Creates a new directory or opens an existing one.
create_gridded_ncdf_file(fname[, div_id]) Makes a gridded netcdf file template.
get_filepath(filename[, div_id]) Absolute path to a specific file.
has_file(filename[, div_id])
log(func[, err])
read_pickle(filename[, div_id]) Reads a pickle located in the directory.
write_monthly_climate_file(time, prcp, temp, ...) Creates a netCDF4 file with climate data.
write_pickle(var, filename[, div_id]) Writes a variable to a pickle on disk.

Attributes

divide_dirs list of the glacier divides directories.
divide_ids Iterator over the glacier divides ids.
grid
n_divides Number of glacier divides.
rgi_area_m2