Description Usage Arguments Details Value Author(s) See Also Examples
This function reallocates data
1 2 | spatial_curation_function_reallocate_data(df_input, dimension_reallocation,
vector_to_reallocate, reallocation_dimensions)
|
df_input |
data.frame of fact |
dimension_reallocation |
dimension to reallocate |
vector_to_reallocate |
vector of data to reallocate |
reallocation_dimensions |
vector of dimensions to use for the reallocation |
Example of use of this function: reallocate the catch of the areas that are located in land over the areas that are located at sea with the same dimensions.
a list with 2 objects:
"df": df_input
where data have been reallocated
"stats": A data.frame with some information regarding the reallocation process:
"value": sum in the input dataset
"value_reallocate": sum reallocated
Paul Taconet, IRD paul.taconet@ird.fr
Other process data: convert_units
,
create_calendar
, create_grid
,
get_rfmos_datasets_level0
,
map_codelist
,
raise_datasets_by_dimension
,
raise_get_rf
,
raise_incomplete_dataset_to_total_dataset
,
rasterize_geo_timeseries
,
spatial_curation_downgrade_resolution
,
spatial_curation_intersect_areas
,
spatial_curation_upgrade_resolution
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Connect to Tuna atlas database
con<-db_connection_tunaatlas_world()
# Extract a dataset from Tuna atlas World database
dataset_metadata<-list_metadata_datasets(con,identifier="atlantic_ocean_catch_1950_01_01_2016_01_01_tunaatlasICCAT_2017_level0__noSchool")
df<-extract_dataset(con,dataset_metadata)
# Retrieve the spatial coding system used in the dataset
df_spatial_codingsystem <- get_codelist_of_dimension(con,dataset_metadata,"area")
# Get data that are fully located inland:
df_intersect_continents<-spatial_curation_intersect_areas(con,df_input=df,df_spatial_code_list_name=df_spatial_codingsystem$dataset_name,intersection_spatial_code_list_name="gshhs_world_coastlines")
areas_inland<-df_intersect_continents$df_input_areas_intersect_intersection_layer$geographic_identifier_source_layer[which(df_intersect_continents$df_input_areas_intersect_intersection_layer$proportion_source_area_intersection==1)]
# In the above, df_intersect_continents$df_input_areas_intersect_intersection_layer$proportion_source_area_intersection==1 means that we want to extract the codes of the areas that are located fully inland (100% of the surface is located inland).
# Reallocate data that are located inland. Reallocate on strata with same month, gear, flag, species, unit :
dataset_reallocate_data_inland<-spatial_curation_function_reallocate_data(
df_input=df,
dimension_reallocation="geographic_identifier",
vector_to_reallocate=areas_inland,
reallocation_dimensions=c("month","gear","flag","species","unit"))
# New dataset with data that were located inland reallocated to areas at sea with same dimensions
head(dataset_reallocate_data_inland$df)
# To get some information on the reallocation process:
dataset_reallocate_data_inland$stats
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.