openquake.calculators.export package

Submodules

openquake.calculators.export.hazard module

class openquake.calculators.export.hazard.DisaggMatrix(poe, iml, dim_labels, matrix)

Bases: tuple

dim_labels

Alias for field number 2

iml

Alias for field number 1

matrix

Alias for field number 3

poe

Alias for field number 0

class openquake.calculators.export.hazard.HazardCurve(location, poes)

Bases: tuple

location

Alias for field number 0

poes

Alias for field number 1

class openquake.calculators.export.hazard.HazardMap(lon, lat, iml)

Bases: tuple

iml

Alias for field number 2

lat

Alias for field number 1

lon

Alias for field number 0

class openquake.calculators.export.hazard.Location(xyz)[source]

Bases: object

class openquake.calculators.export.hazard.UHS(imls, location)

Bases: tuple

imls

Alias for field number 0

location

Alias for field number 1

openquake.calculators.export.hazard.add_imt(fname, imt)[source]
>>> add_imt('/path/to/hcurve_23.csv', 'SA(0.1)')
'/path/to/hcurve-SA(0.1)_23.csv'
openquake.calculators.export.hazard.add_quotes(values)[source]
openquake.calculators.export.hazard.export_avg_gmf_csv(ekey, dstore)[source]
openquake.calculators.export.hazard.export_cond_spectra(ekey, dstore)[source]
openquake.calculators.export.hazard.export_disagg_csv(ekey, dstore)[source]
openquake.calculators.export.hazard.export_event_based_mfd(ekey, dstore)[source]
openquake.calculators.export.hazard.export_events(ekey, dstore)[source]
openquake.calculators.export.hazard.export_fullreport(ekey, dstore)[source]
openquake.calculators.export.hazard.export_gmf_data_csv(ekey, dstore)[source]
openquake.calculators.export.hazard.export_gmf_data_hdf5(ekey, dstore)[source]
openquake.calculators.export.hazard.export_hazard_npz(ekey, dstore)[source]
openquake.calculators.export.hazard.export_hcurves_by_imt_csv(key, kind, fname, sitecol, array, imt, imls, comment)[source]

Export the curves of the given realization into CSV.

Parameters
  • key – output_type and export_type

  • kind – a string with the kind of output (realization or statistics)

  • fname – name of the exported file

  • sitecol – site collection

  • array – an array of shape (N, 1, L1) and dtype numpy.float32

  • imt – intensity measure type

  • imls – intensity measure levels

  • comment – comment dictionary

openquake.calculators.export.hazard.export_hcurves_csv(ekey, dstore)[source]

Exports the hazard curves into several .csv files

Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.hazard.export_hcurves_xml(ekey, dstore)[source]
openquake.calculators.export.hazard.export_hmaps_csv(key, dest, sitemesh, array, comment)[source]

Export the hazard maps of the given realization into CSV.

Parameters
  • key – output_type and export_type

  • dest – name of the exported file

  • sitemesh – site collection

  • array – a composite array of dtype hmap_dt

  • comment – comment to use as header of the exported CSV file

openquake.calculators.export.hazard.export_hmaps_xml(ekey, dstore)[source]
openquake.calculators.export.hazard.export_mean_disagg_by_src(ekey, dstore)[source]
openquake.calculators.export.hazard.export_mean_rates_by_src(ekey, dstore)[source]
openquake.calculators.export.hazard.export_realizations(ekey, dstore)[source]
openquake.calculators.export.hazard.export_ruptures_csv(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.hazard.export_uhs_xml(ekey, dstore)[source]
openquake.calculators.export.hazard.get_kkf(ekey)[source]
Parameters

ekey – export key, for instance (‘uhs/rlz-1’, ‘xml’)

Returns

key, kind and fmt from the export key, i.e. ‘uhs’, ‘rlz-1’, ‘xml’

openquake.calculators.export.hazard.get_metadata(rlzs, kind)[source]
Parameters
  • rlzs – realization array with field ‘branch_path’

  • kind (str) – kind of data, i.e. a key in the datastore

Returns

a dictionary with smlt_path, gsimlt_path, statistics, quantile_value

openquake.calculators.export.hazard.hazard_curve_name(dstore, ekey, kind)[source]
Parameters
  • calc_id – the calculation ID

  • ekey – the export key

  • kind – the kind of key

openquake.calculators.export.hazard.iproduct(*sizes)[source]

openquake.calculators.export.risk module

class openquake.calculators.export.risk.Location(x, y)[source]

Bases: object

class openquake.calculators.export.risk.Output(ltype, path, array)

Bases: tuple

array

Alias for field number 2

ltype

Alias for field number 0

path

Alias for field number 1

openquake.calculators.export.risk.export_agg_risk_csv(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.risk.export_aggcurves_csv(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.risk.export_aggregate_by_csv(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.risk.export_aggrisk(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.risk.export_aggrisk_stats(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.risk.export_asset_risk_csv(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.risk.export_avg_losses(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.risk.export_bcr_map(ekey, dstore)[source]
openquake.calculators.export.risk.export_damages_csv(ekey, dstore)[source]
openquake.calculators.export.risk.export_event_loss_table(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.risk.export_loss_curves(ekey, dstore)[source]
openquake.calculators.export.risk.export_loss_maps_csv(ekey, dstore)[source]
openquake.calculators.export.risk.export_loss_maps_npz(ekey, dstore)[source]
openquake.calculators.export.risk.export_reinsurance(ekey, dstore)[source]
openquake.calculators.export.risk.export_src_loss_table(ekey, dstore)[source]
Parameters
  • ekey – export key, i.e. a pair (datastore key, fmt)

  • dstore – datastore object

openquake.calculators.export.risk.get_aggtags(dstore)[source]
openquake.calculators.export.risk.get_loss_maps(dstore, kind)[source]
Parameters
  • dstore – a DataStore instance

  • kind – ‘rlzs’ or ‘stats’

openquake.calculators.export.risk.get_paths(rlz)[source]
Parameters

rlz – a logic tree realization (composite or simple)

Returns

a dict {‘source_model_tree_path’: string, ‘gsim_tree_path’: string}

openquake.calculators.export.risk.get_rup_data(ebruptures)[source]
openquake.calculators.export.risk.indices(*sizes)[source]
openquake.calculators.export.risk.modal_damage_array(data, damage_dt)[source]
openquake.calculators.export.risk.tag2idx(tags)[source]

Module contents

exception openquake.calculators.export.MissingExporter[source]

Bases: Exception

Raised when there is not exporter for the given pair (dskey, fmt)

openquake.calculators.export.export_csv(ekey, dstore)[source]

Default csv exporter for arrays stored in the output.hdf5 file

Parameters
  • ekey – export key

  • dstore – datastore object

Returns

a list with the path of the exported file

openquake.calculators.export.export_input_zip(ekey, dstore)[source]

Export the data in the input datagroup as a .zip file

openquake.calculators.export.keyfunc(ekey)[source]

Extract the name before the slash:

>>> keyfunc(('risk_by_event', 'csv'))
('risk_by_event', 'csv')
>>> keyfunc(('risk_by_event/1', 'csv'))
('risk_by_event', 'csv')
>>> keyfunc(('risk_by_event/1/0', 'csv'))
('risk_by_event', 'csv')