make_oce_ncdf: Make netCDF from profile and metadata rds files (R workflow)

View source: R/df_to_netcdf.R

make_oce_ncdfR Documentation

Make netCDF from profile and metadata rds files (R workflow)

Description

Read-in files from /accepted_profiles/ and /metadata/ subdirectories and create a netCDF file. Combines data from multiple vessels from the same cruise. Must provide the following global_attributes to the function in a list: references, id, cdm_data_type, cruise, institution, contributor_name, creator_name, creator_institution, creator_email,publisher, publisher_type, publisher_url, geospatial_bounds_crs, license, metadata_link, instrument, standard_name_vocabulary, Conventions, source.

Usage

make_oce_ncdf(
  cast_files = c(list.files(path = here::here("final_cnv", processing_method), full.names
    = TRUE, pattern = "final.rds")),
  metadata_files = c(list.files(path = here::here("metadata"), full.names = TRUE)),
  output_file = "output.nc",
  precision = c(temperature = 4, conductivity = 6, salinity = 4, absolute_salinity = 4,
    sound_speed = 3, density = 3, pressure = 3, oxygen = 4, ph = 3, velocity = 3),
  global_attributes = list(title = "CTD Data from AFSC 2021 EBS/NBS Bottom Trawl Survey",
    references = "CTD TEAM...", id = "doi", cdm_data_type = "Point", cruise =
    "2021 Eastern Bering Sea Continental Shelf and Northern Bering Sea Bottom-Trawl Survey",
    institution = "NOAA Alaska Fisheries Science Center", contributor_name = "",
    creator_name = "", creator_institution = "NOAA Alaska Fisheries Science Center",
    creator_email = "", publisher = "NOAA Alaska Fisheries Science Center",
    publisher_type = "institution", publisher_url =
    "https://www.fisheries.noaa.gov/about/alaska-fisheries-science-center", 
    
    geospatial_bounds_crs = "EPSG:4326", license =
    "These data may be redistributed and used without restriction.", metadata_link =
    "[DOI]", instrument = "CTD", Conventions = "CF-1.8", standard_name_vocabulary =
    "CF Standard Name Table v79", source = paste0("CTD data processed using gapctd ",
    packageVersion(pkg = "gapctd"))),
  vessel_attributes = data.frame(vessel = c(94, 134, 148, 162, 176), vessel_name =
    c("Vesteraalen", "Northwest Explorer", "Ocean Explorer", "Alaska Knight",
    "Alaska Provider"), imo = c(8010219, 7926538, 8412297, 9037769, 8213225), call_sign =
    c("WDJ3586", "WCZ9007", "WCZ9006", "WDD6948", "WDG2215"), flag = c("USA", "USA",
    "USA", "USA", "USA"), year_built = c(1979, 1979, 1984, 1993, 1982))
)

Arguments

cast_files

Paths to accepted profiles.

metadata_files

Paths to metadata files.

output_file

Output filepath for netCDF file.

precision

Precision to use for variables as a named numeric vector.

global_attributes

List of global attributes that is passed to gapctd::df_to_netcdf(global_attributes).

vessel_attributes

data.frame containing vessel metadata

Author(s)

Sean Rohan


afsc-gap-products/gapctd documentation built on March 5, 2025, 3:42 a.m.