Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use productivity, production cost, and production value. #4344

Merged
merged 4 commits into from Jul 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file not shown.
12 changes: 6 additions & 6 deletions safe/definitions/concepts.py
Expand Up @@ -653,9 +653,9 @@
}
],
}
concepts['productivity_cost'] = {
'group': tr('Productivity Cost'),
'key': 'productivity_cost',
concepts['production_cost'] = {
'group': tr('Production Cost'),
'key': 'production_cost',
'description': tr(
'How much money needed to re-build a crop in an area.'),
'citations': [
Expand All @@ -665,9 +665,9 @@
}
],
}
concepts['productivity_value'] = {
'group': tr('Productivity Value'),
'key': 'productivity_value',
concepts['production_value'] = {
'group': tr('Production Value'),
'key': 'production_value',
'description': tr('The value of a crop in an area.'),
'citations': [
{
Expand Down
8 changes: 4 additions & 4 deletions safe/definitions/exposure.py
Expand Up @@ -16,8 +16,8 @@
population_count_field,
exposure_type_field,
productivity_rate_field,
productivity_cost_rate_field,
productivity_value_rate_field)
production_cost_rate_field,
production_value_rate_field)
from safe.definitions.field_groups import population_field_groups
from safe.definitions.layer_modes import (
layer_mode_continuous, layer_mode_classified)
Expand Down Expand Up @@ -450,8 +450,8 @@
# feature_value_field, disabled in V4.0, ET 13/02/17
# feature_rate_field disabled in V4.0, ET 13/02/17
productivity_rate_field,
productivity_cost_rate_field,
productivity_value_rate_field
production_cost_rate_field,
production_value_rate_field
],
'field_groups': [],
'layer_modes': [layer_mode_classified],
Expand Down
94 changes: 47 additions & 47 deletions safe/definitions/fields.py
Expand Up @@ -2120,8 +2120,8 @@
'precision': 0,
'absolute': True,
'description': tr(
'The rate of productivity of a crop in Quintal (hundred '
'kilograms)/Hectare unit.'),
'The weight of a crop from land cover can produce per area unit. The '
'unit is in Quintal (100 kilograms) / Hectare.'),
'help_text': tr(
'For a land cover, productivity is the rate of product weight per '
'area.'
Expand All @@ -2145,7 +2145,8 @@
'precision': default_field_precision,
'absolute': True,
'description': tr(
'The productivity of a crop in Quintal (hundred kilograms unit.)'),
'The total weight of a crop that can be produced from the land cover '
'area. The unit is in Quintal (hundred kilograms).'),
'help_text': tr(
'For a land cover, productivity is the weight of product.'
),
Expand All @@ -2169,8 +2170,7 @@
'precision': default_field_precision,
'absolute': True,
'description': tr(
'The affected productivity of a crop in Quintal (hundred kilograms '
'unit.)'),
'The affected productivity of a crop in Quintal (hundred kilograms).'),
'help_text': tr(
'For a land cover, affected productivity is the weight of product '
'that is affected by the hazard.'
Expand All @@ -2186,19 +2186,19 @@
'units': [unit_quintal]
}

# Productivity cost field
productivity_cost_rate_field = {
'key': 'productivity_cost_rate_field',
'name': tr('Productivity Cost Rate'),
'field_name': 'productivity_cost_rate',
# Production cost field
production_cost_rate_field = {
'key': 'production_cost_rate_field',
'name': tr('Production Cost Rate'),
'field_name': 'production_cost_rate',
'type': qvariant_numbers,
'length': default_field_length,
'precision': 0,
'absolute': True,
'description': tr(
'The rate of productivity cost of a crop in Currency/Hectare unit.'),
'The rate of production cost of a crop in Currency/Hectare unit.'),
'help_text': tr(
'For a land cover, productivity cost rate is the rate of product '
'For a land cover, production cost rate is the rate of product '
'cost per area. It is the cost to build the area.'
),
'citations': [
Expand All @@ -2211,18 +2211,18 @@
'replace_null': False,
}

productivity_cost_field = {
'key': 'productivity_cost_field',
'name': tr('Productivity Cost'),
'field_name': 'productivity_cost',
production_cost_field = {
'key': 'production_cost_field',
'name': tr('Production Cost'),
'field_name': 'production_cost',
'type': QVariant.Double,
'length': default_field_length,
'precision': default_field_precision,
'absolute': True,
'description': tr(
'The productivity cost of a crop in Currency unit.'),
'The production cost of a crop in Currency unit.'),
'help_text': tr(
'For a land cover, productivity cost is the cost to build the area.'
'For a land cover, production cost is the cost to build the area.'
),
'citations': [
{
Expand All @@ -2234,19 +2234,19 @@
'replace_null': False,
}

affected_productivity_cost_field = {
'key': 'affected_productivity_cost_field',
'name': tr('Affected Productivity Cost'),
'field_name': 'affected_productivity_cost',
affected_production_cost_field = {
'key': 'affected_production_cost_field',
'name': tr('Affected Production Cost'),
'field_name': 'affected_production_cost',
'header_name': tr('Production Cost'),
'type': QVariant.Double,
'length': default_field_length,
'precision': default_field_precision,
'absolute': True,
'description': tr(
'The affected productivity cost of a crop in Currency unit.'),
'The affected production cost of a crop in Currency unit.'),
'help_text': tr(
'For a land cover, affected productivity cost is the cost to build '
'For a land cover, affected production cost is the cost to build '
'the area that is affected by a hazard.'
),
'citations': [
Expand All @@ -2261,19 +2261,19 @@
}


# Productivity value field
productivity_value_rate_field = {
'key': 'productivity_value_rate_field',
'name': tr('Productivity Value Rate'),
'field_name': 'productivity_value_rate',
# Production value field
production_value_rate_field = {
'key': 'production_value_rate_field',
'name': tr('Production Value Rate'),
'field_name': 'production_value_rate',
'type': qvariant_numbers,
'length': default_field_length,
'precision': 0,
'absolute': True,
'description': tr(
'The rate of productivity value of a crop in Currency/Hectare unit.'),
'The rate of production value of a crop in Currency/Hectare unit.'),
'help_text': tr(
'For a land cover, productivity cost rate is the rate of product '
'For a land cover, production value rate is the rate of product '
'cost per area. It is the value of the area.'
),
'citations': [
Expand All @@ -2286,18 +2286,18 @@
'replace_null': False,
}

productivity_value_field = {
'key': 'productivity_value_field',
'name': tr('Productivity Value'),
'field_name': 'productivity_value',
production_value_field = {
'key': 'production_value_field',
'name': tr('Production Value'),
'field_name': 'production_value',
'type': QVariant.Double,
'length': default_field_length,
'precision': default_field_precision,
'absolute': True,
'description': tr(
'The productivity value of a crop in Currency unit.'),
'The production value of a crop in Currency unit.'),
'help_text': tr(
'For a land cover, productivity cost is the value of the area.'
'For a land cover, production value is the value of the area.'
),
'citations': [
{
Expand All @@ -2309,19 +2309,19 @@
'replace_null': False,
}

affected_productivity_value_field = {
'key': 'affected_productivity_value_field',
'name': tr('Affected Productivity Value'),
'field_name': 'affected_productivity_value',
affected_production_value_field = {
'key': 'affected_production_value_field',
'name': tr('Affected Production Value'),
'field_name': 'affected_production_value',
'header_name': tr('Production Value'),
'type': QVariant.Double,
'length': default_field_length,
'precision': default_field_precision,
'absolute': True,
'description': tr(
'The affected productivity value of a crop in Currency unit.'),
'The affected production value of a crop in Currency unit.'),
'help_text': tr(
'For a land cover, affected productivity cost is the value of the '
'For a land cover, affected production value is the value of the '
'area that is affected by a hazard.'
),
'citations': [
Expand Down Expand Up @@ -2415,16 +2415,16 @@
# summary table
summarizer_fields = [
productivity_field,
productivity_cost_field,
productivity_value_field
production_cost_field,
production_value_field
]

# Mapping between summarizer field and its affected fields in the exposure
# summary table
affected_summarizer_fields = {
productivity_field['key']: affected_productivity_field,
productivity_cost_field['key']: affected_productivity_cost_field,
productivity_value_field['key']: affected_productivity_value_field,
production_cost_field['key']: affected_production_cost_field,
production_value_field['key']: affected_production_value_field,
}

# Add also minimum needs fields
Expand Down
50 changes: 24 additions & 26 deletions safe/definitions/post_processors/productivity_post_processors.py
Expand Up @@ -5,11 +5,11 @@
from safe.definitions.fields import (
size_field,
productivity_rate_field,
productivity_cost_rate_field,
productivity_value_rate_field,
production_cost_rate_field,
production_value_rate_field,
productivity_field,
productivity_cost_field,
productivity_value_field
production_cost_field,
production_value_field
)
from safe.definitions.post_processors.post_processor_inputs import (
field_input_type)
Expand Down Expand Up @@ -46,15 +46,14 @@
}
}
}
post_processor_productivity_cost = {
'key': 'post_processor_productivity_cost',
'name': tr('Productivity Cost Post Processor'),
post_processor_production_cost = {
'key': 'post_processor_production_cost',
'name': tr('Production Cost Post Processor'),
'description': tr(
'A post processor to calculate the productivity cost for each feature'
),
'A post processor to calculate the production cost for each feature'),
'input': {
'productivity_cost_rate': {
'value': productivity_cost_rate_field,
'production_cost_rate': {
'value': production_cost_rate_field,
'type': field_input_type,
},
# In meter square
Expand All @@ -64,22 +63,21 @@
},
},
'output': {
'productivity_cost': {
'value': productivity_cost_field,
'production_cost': {
'value': production_cost_field,
'type': formula_process,
'formula': 'productivity_cost_rate * size / 10000'
'formula': 'production_cost_rate * size / 10000'
}
}
}
post_processor_productivity_value = {
'key': 'post_processor_productivity_value',
'name': tr('Productivity Value Post Processor'),
post_processor_production_value = {
'key': 'post_processor_production_value',
'name': tr('Production Value Post Processor'),
'description': tr(
'A post processor to calculate the productivity value for each feature'
),
'A post processor to calculate the production value for each feature'),
'input': {
'productivity_value_rate': {
'value': productivity_value_rate_field,
'production_value_rate': {
'value': production_value_rate_field,
'type': field_input_type,
},
# In meter square
Expand All @@ -89,16 +87,16 @@
},
},
'output': {
'productivity_value': {
'value': productivity_value_field,
'production_value': {
'value': production_value_field,
'type': formula_process,
'formula': 'productivity_value_rate * size / 10000'
'formula': 'production_value_rate * size / 10000'
}
}
}

productivity_post_processors = [
post_processor_productivity,
post_processor_productivity_cost,
post_processor_productivity_value
post_processor_production_cost,
post_processor_production_value
]
8 changes: 4 additions & 4 deletions safe/definitions/reports/components.py
Expand Up @@ -42,8 +42,8 @@
elderly_displaced_count_field,
exposure_count_field,
affected_productivity_field,
affected_productivity_cost_field,
affected_productivity_value_field)
affected_production_cost_field,
affected_production_value_field)
from safe.definitions.styles import charcoal_black
from safe.report.extractors.action_notes import (
action_checklist_extractor,
Expand Down Expand Up @@ -233,8 +233,8 @@
'exposure_extra_fields': {
exposure_land_cover['key']: [
affected_productivity_field,
affected_productivity_cost_field,
affected_productivity_value_field,
affected_production_cost_field,
affected_production_value_field,
],
},
}
Expand Down
8 changes: 4 additions & 4 deletions safe/definitions/test/test_utilities.py
Expand Up @@ -44,8 +44,8 @@
population_field_groups,
aggregation_field_groups,
productivity_rate_field,
productivity_cost_rate_field,
productivity_value_rate_field,
production_cost_rate_field,
production_value_rate_field,
provenance_host_name,
provenance_user
)
Expand Down Expand Up @@ -277,8 +277,8 @@ def test_get_fields(self):
expected_fields += deepcopy(exposure_fields)
expected_fields += [
productivity_rate_field,
productivity_cost_rate_field,
productivity_value_rate_field
production_cost_rate_field,
production_value_rate_field
]
self.assertListEqual(fields, expected_fields)

Expand Down