spatial_curation_upgrade_resolution: Aggregate gridded data

View source: R/spatial_curation_upgrade_resolution.R

spatial_curation_upgrade_resolutionR Documentation

Aggregate gridded data

Description

This function aggregates the data of a dataset on a grid with resolution equal to resolution. Data with resolutions inferior to resolution will be aggregated on the corresponding resolution quadrant. Data with resolutions superior to resolution will not be disaggregated. To disaggregate data with resolutions superior to resolution, use the function spatial_curation_downgrade_resolution

Usage

spatial_curation_upgrade_resolution(con, df_input, resolution)

Arguments

con

a wrapper of rpostgresql connection (connection to a database)

df_input

data.frame of fact. The data frame must contain at least one column "geographical_identifier" with CWP grid codification or IOTC irregular areas from catch-and-effort datasets.

resolution

integer. Resolution to reach (in degrees). Currently, works only with 5.

Value

a list with 2 objects:

  • "df": df_input where data have been aggregated

  • "stats": A data.frame with some information regarding the process

Author(s)

Paul Taconet, IRD paul.taconet@ird.fr

See Also

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_reallocate_data

Examples



# Connect to Tuna atlas database
con<-db_connection_tunaatlas_world()

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)

# Aggregate data with resolutions inferior to 5° on the corresponding 5° resolution grid:
df_aggregated_5_deg<-spatial_curation_upgrade_resolution(con,df_input=df,resolution=5)

head(df_aggregated_5_deg$df)
# In this dataset, data that were defined on a grid inferior to 5° were aggregated on the corresponding 5° resolution, other data remained at their source resolution
# if you want the data superior to 5° to be disaggregated on the 5° grid, use : 
# spatial_curation_downgrade_resolution(con,df_input=df_aggregated_5_deg,resolution=5)


ptaconet/rtunaatlas documentation built on June 23, 2024, 9:35 p.m.