Conversation
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
air
[air] reported by reviewdog 🐶
Line 333 in 308f210
[air] reported by reviewdog 🐶
Line 335 in 308f210
[air] reported by reviewdog 🐶
Line 338 in 308f210
[air] reported by reviewdog 🐶
Lines 340 to 345 in 308f210
[air] reported by reviewdog 🐶
Lines 349 to 350 in 308f210
[air] reported by reviewdog 🐶
Lines 355 to 372 in 308f210
[air] reported by reviewdog 🐶
Line 375 in 308f210
[air] reported by reviewdog 🐶
Lines 376 to 381 in 308f210
[air] reported by reviewdog 🐶
Lines 386 to 387 in 308f210
[air] reported by reviewdog 🐶
Lines 390 to 391 in 308f210
[air] reported by reviewdog 🐶
Lines 394 to 397 in 308f210
[air] reported by reviewdog 🐶
Line 399 in 308f210
[air] reported by reviewdog 🐶
Line 400 in 308f210
[air] reported by reviewdog 🐶
Line 402 in 308f210
[air] reported by reviewdog 🐶
Lines 404 to 408 in 308f210
[air] reported by reviewdog 🐶
Lines 410 to 411 in 308f210
[air] reported by reviewdog 🐶
Line 414 in 308f210
[air] reported by reviewdog 🐶
Lines 416 to 419 in 308f210
[air] reported by reviewdog 🐶
Lines 422 to 425 in 308f210
[air] reported by reviewdog 🐶
Line 429 in 308f210
[air] reported by reviewdog 🐶
Lines 432 to 437 in 308f210
[air] reported by reviewdog 🐶
Lines 444 to 445 in 308f210
[air] reported by reviewdog 🐶
Line 449 in 308f210
[air] reported by reviewdog 🐶
Lines 452 to 454 in 308f210
[air] reported by reviewdog 🐶
Line 456 in 308f210
[air] reported by reviewdog 🐶
Lines 458 to 461 in 308f210
[air] reported by reviewdog 🐶
Line 465 in 308f210
[air] reported by reviewdog 🐶
Lines 469 to 470 in 308f210
[air] reported by reviewdog 🐶
Lines 477 to 480 in 308f210
[air] reported by reviewdog 🐶
Lines 484 to 488 in 308f210
[air] reported by reviewdog 🐶
Line 491 in 308f210
[air] reported by reviewdog 🐶
Lines 494 to 495 in 308f210
[air] reported by reviewdog 🐶
Line 508 in 308f210
[air] reported by reviewdog 🐶
Lines 510 to 516 in 308f210
[air] reported by reviewdog 🐶
Lines 518 to 520 in 308f210
[air] reported by reviewdog 🐶
Line 523 in 308f210
[air] reported by reviewdog 🐶
Line 525 in 308f210
[air] reported by reviewdog 🐶
Line 527 in 308f210
[air] reported by reviewdog 🐶
Line 534 in 308f210
[air] reported by reviewdog 🐶
Line 539 in 308f210
[air] reported by reviewdog 🐶
Line 541 in 308f210
[air] reported by reviewdog 🐶
Line 545 in 308f210
[air] reported by reviewdog 🐶
Line 550 in 308f210
[air] reported by reviewdog 🐶
Line 552 in 308f210
[air] reported by reviewdog 🐶
Lines 20 to 21 in 308f210
[air] reported by reviewdog 🐶
Line 23 in 308f210
[air] reported by reviewdog 🐶
Line 25 in 308f210
[air] reported by reviewdog 🐶
Line 31 in 308f210
[air] reported by reviewdog 🐶
Line 36 in 308f210
[air] reported by reviewdog 🐶
Line 39 in 308f210
[air] reported by reviewdog 🐶
Lines 46 to 52 in 308f210
…into alice/grafs_plot
TODOs:
GRAFS plot dataset description
This PR introduces the main function
create_grafs_plot_df(), which includes helper functions to generate a dataset of nitrogen (MgN) flows by province and year as well as land use information in Spain. The data are assigned to labels, defined by Alfredo Rodriguez, which are needed to create GRAFS plots with Alfredo’s R package.The resulting tibble is designed to feed directly into the GRAFS visualization R package.
Label description
Land use and land N production
Land use areas and associated N production are taken from n_balance_ygpit_all.
They are aggregated by province and year and mapped to labels such as:
cropland N and area ({ARAiN}, {ARArN}, {ARAiha}, {ARArha}),
permanent crops ({PERiN}, {PERrN}),
horticulture ({HORiN}, {HORrN}),
forest and semi-natural systems ({FORN}),
grassland ({HAGRASS}, {GRASSMha})
greenhouse systems ({GREHN}).
Both irrigated and rainfed systems are treated separately.
Crop and grass N consumption
N flows (consumption) from cropland and grassland are taken from create_n_prov_destiny() and tranformed to labels including:
crops to population ({CROPS_TO_POP}),
crops to livestock ({CROPS_TO_LIVESTOCK}),
grass to livestock ({GRASS_TO_LIVESTOCK}),
crop exports ({CROP_EXPORT}),
crop N used for other uses ({CRP_OTHUSES}).
Livestock production
Livestock N production is taken from create_n_prov_destiny() and livestock_prod_ygps.
It is separated into edible and non-edible products and mapped to:
edible livestock products ({LV_EDBL}),
non-edible livestock products ({LVSTCK_NOEDIBLE}),
milk and dairy products ({LVST_MILK}),
exported livestock products ({LIVESTOCK_EXPORTED}).
Livestock losses and totals
Livestock N losses are taken from n_excretion_ygs and population-related other uses.
They are represented using the labels:
livestock losses ({AN_LS}),
livestock other uses ({AN_OTH}),
total livestock losses ({AN_LS_OTH}),
total livestock N ({LVSTCKTOTN}),
gaseous N losses ({LIVGASLOSS}).
Feed and internal transfers
Feed flows from cropland to livestock are taken from create_n_prov_destiny() and split into:
ruminant feed ({RCRTOLVSTCK_R}),
monogastric feed ({MCRTOLVSTCK_M}).
Imports and N soil inputs
N imports and N soil inputs are taken from create_n_prov_destiny() and n_balance_ygpit_all.
They are mapped to labels such as:
crop and animal product imports ({CROP_POPIMPORT}, {IMANOT}, {IMPORT_ANIMALCR}),
synthetic fertilizers ({SYNTHF}, {SYNTHF_TOTAL}),
biological fixation and atmospheric deposition ({FIXCR}, {OXDEPCROPS}, {FIX_DEP_CR}, {FIX_DEP_GRASS}),
wastewater inputs from population ({WASTEWATER}).
Livestock units and population
Livestock units (LU) are calculated from livestock_prod_ygps stock numbers and included using:
ruminant LU ({RUMIANTSLU}, {RUMIANTSMLU}),
monogastric LU ({MONOGLU}, {MONOGMLU}).
Population data are taken from population_yg and included as {POPULATIONM}.
Final steps
All datasets are merged into a single standardized table.
Missing labels required for plotting are added with zero values.