api.projections

api.projections

Functions

Name Description
copy_projection Copy a projection in the database.
create_projection Create a new projection object.
delete_projection Delete a projection from the database.
edit_projection Edit a projection object in the database.
get_projection Get a projection from the database by name.
get_projections Get all projections from the database.
get_slr_scn_names Get all sea level rise scenario names from the database.
interp_slr Interpolate sea level rise for a given scenario and year.
plot_slr_scenarios Plot sea level rise scenarios.
save_projection Save a projection object to the database.

copy_projection

api.projections.copy_projection(old_name, new_name, new_description)

Copy a projection in the database.

Parameters

Name Type Description Default
old_name str The name of the projection to copy. required
new_name str The name of the new projection. required
new_description str The description of the new projection required

create_projection

api.projections.create_projection(attrs)

Create a new projection object.

Parameters

Name Type Description Default
attrs dict[str, Any] The attributes of the projection object to create. Should adhere to the ProjectionModel schema. required

Returns

Name Type Description
IProjection The projection object created from the attributes.

Raises

Name Type Description
ValueError If the attributes do not adhere to the ProjectionModel schema.

delete_projection

api.projections.delete_projection(name)

Delete a projection from the database.

Parameters

Name Type Description Default
name str The name of the projection to delete. required

Raises

Name Type Description
ValueError If the projection does not exist. If the projection is used in a scenario.

edit_projection

api.projections.edit_projection(projection)

Edit a projection object in the database.

Parameters

Name Type Description Default
projection IProjection The projection object to edit. required

Raises

Name Type Description
ValueError If the projection object does not exist.

get_projection

api.projections.get_projection(name)

Get a projection from the database by name.

Parameters

Name Type Description Default
name str The name of the projection to retrieve. required

Returns

Name Type Description
IProjection The projection object with the given name.

Raises

Name Type Description
ValueError If the projection with the given name does not exist.

get_projections

api.projections.get_projections()

Get all projections from the database.

Returns

Name Type Description
dict[str, Any] A dictionary containing all projections. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’ Each value is a list of the corresponding attribute for each projection.

get_slr_scn_names

api.projections.get_slr_scn_names()

Get all sea level rise scenario names from the database.

Returns

Name Type Description
list List of scenario names

interp_slr

api.projections.interp_slr(slr_scenario, year)

Interpolate sea level rise for a given scenario and year.

Parameters

Name Type Description Default
slr_scenario str The name of the sea level rise scenario. required
year float The year to interpolate sea level rise for. required

Returns

Name Type Description
float The interpolated sea level rise for the given scenario and year.

plot_slr_scenarios

api.projections.plot_slr_scenarios()

Plot sea level rise scenarios.

Returns

Name Type Description
str The path to the html plot of the sea level rise scenarios.

save_projection

api.projections.save_projection(projection)

Save a projection object to the database.

Parameters

Name Type Description Default
projection IProjection The projection object to save. required

Raises

Name Type Description
ValueError If the projection object is not valid.
Back to top