spatial_curation_downgrade_resolution: Disaggregate gridded data

Description Usage Arguments Value Author(s) See Also Examples

View source: R/spatial_curation_downgrade_resolution.R

Description

This function disaggregates or remove the data of a df_input on a grid with resolution equal to resolution. Data with resolutions superior to resolution will be disaggregated on the corresponding resolution quadrant by dividing the catch equally on the overlappings resolution quadrants, or removed. Data with resolutions inferior to resolution will not be aggregated. To aggregate data with resolutions inferior to resolution, use the function spatial_curation_upgrade_resolution

Usage

1
2
spatial_curation_downgrade_resolution(con, df_input, resolution,
  remove = FALSE)

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 with 1 and 5.

remove

boolean. Remove from the dataset data that are defined on resolutions superior to resolution? Default is FALSE

Value

a list with 2 objects:

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_intersect_areas, spatial_curation_reallocate_data, spatial_curation_upgrade_resolution

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 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)

# Disaggregate data with resolutions superior to 5° on the corresponding 5° resolution grid, by dividing the catch equally on the overlappings \code{resolution} quadrants:
df_disaggregated_5_deg<-spatial_curation_downgrade_resolution(con,df_input=df,resolution=5)

head(df_disaggregated_5_deg$df)

# Some stats (percentage of the data that have been disaggregated)
df_disaggregated_5_deg$stats

# In this df_input, data that were defined on a grid superior to 5° were disaggregated on the corresponding 5° resolution, other data remained at their source resolution (e.g. data at 1° resolution will not be aggregated on the corresponding 5° grid)
# if you want the data inferior to 5° to be aggregated on the 5° grid, use : 
# spatial_curation_downgrade_resolution(con,df_input=df_disaggregated_5_deg,resolution=5)

ptaconet/rtunaatlas documentation built on Sept. 21, 2021, 10:43 p.m.