# vim:filetype=r:textwidth=80:expandtab:shiftwidth=4:softtabstop=4
useDynLib(oce, .registration = TRUE)
# exportPattern("^[[:alpha:]]+")
importFrom(Rcpp, sourceCpp)

importFrom(
    "graphics", ".filled.contour", "axTicks", "abline", "arrows", "axis",
    "Axis", "axis.POSIXct", "box", "contour", "frame", "grid", "hist", "image",
    "layout", "lcm", "legend", "lines", "locator", "mtext", "pairs", "par",
    "plot", "plot.new", "plot.window", "points", "polygon", "rect", "rug",
    "segments", "smoothScatter", "strheight", "strwidth", "text", "title",
    "xinch", "yinch"
)

importFrom(
    "grDevices", "adjustcolor", "col2rgb", "colorRamp",
    "colorRampPalette", "contourLines", "gray", "hsv", "rgb"
)

importFrom(
    "gsw", "gsw_CT_freezing", "gsw_CT_from_t", "gsw_C_from_SP",
    "gsw_Nsquared", "gsw_SA_from_SP", "gsw_SA_from_rho", "gsw_SP_from_C",
    "gsw_SP_from_SA", "gsw_SR_from_SP", "gsw_Sstar_from_SA",
    "gsw_Turner_Rsubrho", "gsw_adiabatic_lapse_rate_from_CT", "gsw_alpha",
    "gsw_alpha_on_beta", "gsw_beta", "gsw_cp_t_exact",
    "gsw_geo_strf_dyn_height", "gsw_p_from_z", "gsw_pot_rho_t_exact",
    "gsw_pt_from_t", "gsw_rho", "gsw_sigma0", "gsw_sigma1", "gsw_sigma2",
    "gsw_sigma3", "gsw_sigma4", "gsw_sound_speed", "gsw_t_freezing",
    "gsw_t_from_CT", "gsw_z_from_p"
)

importFrom(
    "methods", "as", "callNextMethod", "new", "slot<-", "slotNames",
    "validObject"
)

# importFrom("sf", "st_intersection", "st_multipoint", "st_polygon")
importFrom(
    "stats", "approx", "approxfun", "coef", "confint", "cor", "cov",
    "fivenum", "frequency", "integrate", "is.ts", "kernel", "lm", "median",
    "na.exclude", "nls", "optim", "optimize", "predict", "printCoefmat",
    "quantile", "rnorm", "runmed", "sd", "smooth", "smooth.spline", "spectrum",
    "ts", "uniroot", "var", "weighted.mean", "window"
)

# importFrom("testthat", "expect_equal", "expect_error", "expect_false",
#           "expect_identical", "expect_lt", "expect_null", "expect_output",
#           "expect_silent", "expect_true", "expect_warning")

importFrom(
    "utils", "capture.output", "data", "download.file", "head",
    "flush.console", "packageVersion", "read.csv", "read.delim", "read.table",
    "setTxtProgressBar", "str", "tail", "txtProgressBar", "unzip",
    "write.table"
)

exportMethods(plot)
exportMethods(subset)
exportMethods(summary)
export(
    abbreviateTimeLabels,
    ad2cpCodeToName,
    adpAd2cpFileTrim,
    adpRdiFileTrim,
    # advSontekAdrFileTrim,
    approx3d,
    argShow,
    beamName,
    bound125,
    ad2cpHeaderValue,
    addSpine,
    adpConvertRawToNumeric,
    adpEnsembleAverage,
    adpFlagPastBoundary,
    airRho,
    angleRemap,
    angle2hms,
    applyMagneticDeclination,
    argo2ctd,
    argoGrid,
    argoJuldToTime,
    argoNames2oceNames,
    as.adp,
    as.argo,
    as.cm,
    as.coastline,
    as.ctd,
    as.echosounder,
    as.gps,
    as.ladp,
    as.lisst,
    as.lobo,
    as.met,
    as.oce,
    as.rsk,
    as.sealevel,
    as.section,
    as.tidem,
    as.topo,
    as.unit,
    as.windrose,
    as.xbt,
    bcdToInteger,
    beamUnspreadAdp,
    beamToXyz,
    beamToXyzAdp,
    beamToXyzAdpAD2CP,
    beamToXyzAdv,
    bilinearInterp,
    binmapAdp,
    binAverage,
    binApply1D,
    binApply2D,
    binCount1D,
    binCount2D,
    binMean1D,
    binMean2D,
    bodcNames2oceNames,
    byteToBinary,
    cnvName2oceName,
    coastlineBest,
    coastlineCut,
    colormap,
    colormapGMT,
    composite,
    computableWaterProperties,
    concatenate,
    coriolis,
    ctdDecimate,
    ctdFindProfiles,
    ctdFindProfilesRBR,
    ctdRepair,
    ctdTrim,
    ctimeToSeconds,
    curl,
    dataLabel,
    decimate,
    decodeHeaderNortek,
    decodeTime,
    defaultFlags,
    despike,
    detrend,
    download.amsr,
    download.coastline,
    download.met,
    download.topo,
    drawDirectionField,
    drawIsopycnals,
    drawPalette,
    eclipticalToEquatorial,
    enuToOther,
    enuToOtherAdp,
    enuToOtherAdv,
    equatorialToLocalHorizontal,
    errorbars,
    fillGap,
    fillGapMatrix,
    findBottom,
    firstFinite,
    formatCI,
    formatPosition,
    fullFilename,
    gappyIndex,
    geodGc,
    geodDist,
    geodXy,
    geodXyInverse,
    GMTOffsetFromTz,
    grad,
    gravity,
    handleFlags,
    handleFlagsInternal,
    imagep,
    initializeFlagScheme,
    initializeFlagSchemeInternal,
    initializeFlags,
    interpBarnes,
    integerToAscii,
    integrateTrapezoid,
    is.ad2cp,
    julianDay,
    julianCenturyAnomaly,
    labelWithUnit,
    landsatAdd,
    landsatTrim,
    latFormat,
    latlonFormat,
    locationForGsw,
    lookWithin,
    longitudeTighten,
    lonlat2utm,
    lonlat2map,
    lonFormat,
    lon360,
    lowpass,
    magneticField,
    makeFilter,
    mapArrows,
    mapAxis,
    mapContour,
    mapCoordinateSystem,
    mapDirectionField,
    mapGrid,
    mapImage,
    mapLines,
    mapLocator,
    mapLongitudeLatitudeXY,
    mapPlot,
    mapPoints,
    mapPolygon,
    mapScalebar,
    mapText,
    mapTissot,
    map2lonlat,
    matchBytes,
    matrixShiftLongitude,
    matrixSmooth,
    metNames2oceNames,
    moonAngle,
    netcdfTOC,
    numberAsHMS,
    numberAsPOSIXct,
    ODF2oce,
    ODFListFromHeader,
    ODFNames2oceNames,
    oce.approx, oceApprox,
    oce.as.raw,
    oce.axis.POSIXct,
    oceAxis,
    oceColorsClosure,
    oce.colors9A, oceColors9A,
    oce.colors9B, oceColors9B,
    oce.colorsCDOM, oceColorsCDOM,
    oce.colorsChlorophyll, oceColorsChlorophyll,
    oce.colorsCubeHelix, oceColorsCubeHelix,
    oce.colorsDensity, oceColorsDensity,
    oce.colorsFreesurface, oceColorsFreesurface,
    oce.colorsGebco, oceColorsGebco,
    oce.colorsJet, oceColorsJet,
    oce.colorsOxygen, oceColorsOxygen,
    oce.colorsPalette, oceColorsPalette,
    oce.colorsPAR, oceColorsPAR,
    oce.colorsPhase, oceColorsPhase,
    oce.colorsSalinity, oceColorsSalinity,
    oce.colorsTemperature, oceColorsTemperature,
    oce.colorsTwo, oceColorsTwo,
    oce.colorsTurbo, oceColorsTurbo,
    oce.colorsTurbidity, oceColorsTurbidity,
    oce.colorsVelocity, oceColorsVelocity,
    oce.colorsViridis, oceColorsViridis,
    oce.colorsVorticity, oceColorsVorticity,
    oceCRS,
    oceFileTrim,
    oceGetData,
    oceDeleteData,
    oceRename,
    oceRenameData,
    oceSetData,
    oceGetMetadata, oceDeleteMetadata, oceRenameMetadata, oceSetMetadata,
    oce.debug, oceDebug,
    oce.edit, oceEdit,
    oce.filter, oceFilter,
    oceMagic,
    oce.convolve, oceConvolve,
    oce.contour, oceContour,
    oce.grid,
    oceNames2whpNames,
    oceProject,
    oceUnits2whpUnits,
    oce.plot.ts,
    oce.pmatch, ocePmatch,
    oce.smooth, oceSmooth,
    oce.spectrum, oceSpectrum,
    oce.write.table,
    parseLatLon,
    presentTime,
    plotPolar,
    plotTaylor,
    predict.tidem,
    "processingLog<-",
    processingLogAppend,
    processingLogShow,
    plotInset,
    plotSticks,
    plotTS,
    plotScan,
    plotProfile,
    preferAdjusted,
    prettyPosition,
    pwelch,
    rangeExtended,
    rangeLimit,
    read.adp,
    read.adp.ad2cp,
    read.adp.rdi,
    read.adp.nortek,
    read.adp.sontek,
    read.adp.sontek.serial,
    read.adv,
    read.adv.nortek,
    read.adv.sontek.serial,
    read.adv.sontek.adr,
    read.adv.sontek.text,
    read.amsr,
    read.aquadopp, # wrapper for read.adp.nortek()
    read.aquadoppProfiler, # wrapper for read.adp.nortek()
    read.aquadoppHR, # wrapper for read.adp.nortek()
    read.argo,
    read.argo.copernicus,
    read.bremen,
    read.cm,
    read.coastline,
    read.coastline.shapefile,
    read.coastline.openstreetmap,
    read.ctd,
    read.ctd.aml,
    read.ctd.sbe,
    read.ctd.ssda,
    read.ctd.woce,
    read.ctd.woce.other,
    read.ctd.odf,
    read.ctd.odv,
    read.ctd.itp,
    read.ctd.saiv,
    read.echosounder,
    read.g1sst,
    read.gps,
    read.index,
    read.landsat,
    read.lisst,
    read.lobo,
    read.met,
    read.topo,
    read.netcdf,
    read.oce,
    read.odf,
    read.rsk,
    read.sealevel,
    read.sealevel.gc2026,
    read.section,
    read.woa,
    read.xbt,
    read.xbt.edf,
    read.xbt.noaa1,
    read.xbt.noaa2,
    rescale,
    resizableLabel,
    retime,
    rotateAboutZ,
    rsk2ctd,
    rskPatm,
    rskToc,
    ## rskTrim,
    runlm,
    secondsToCtime,
    sectionAddCtd,
    sectionAddStation,
    sectionGrid,
    sectionSmooth,
    sectionSort,
    setFlags,
    shiftLongitude,
    showMetadataItem,
    siderealTime,
    snakeToCamel,
    standardDepths,
    sunAngle,
    sunDeclinationRightAscension,
    swAbsoluteSalinity,
    swAlpha,
    swAlphaOverBeta,
    swBeta,
    swConservativeTemperature,
    swCSTp,
    swDepth,
    swZ,
    swDynamicHeight,
    swLapseRate,
    swN2,
    swPressure,
    swRho,
    swRrho,
    swSCTp,
    swSigma,
    swSigmaT,
    swSigmaTheta,
    swSigma0, swSigma1, swSigma2, swSigma3, swSigma4,
    swSoundAbsorption,
    swSoundSpeed,
    swSpecificHeat,
    swSpice,
    swSpiciness0,
    swSpiciness1,
    swSpiciness2,
    swSR,
    swSstar,
    swSTrho,
    swTFreeze,
    swThermalConductivity,
    swTheta,
    swTSrho,
    swViscosity,
    subtractBottomVelocity,
    standardizeLongitude,
    T68fromT90,
    T90fromT48,
    T90fromT68,
    threenum,
    tidem,
    tidemAstron,
    tidemConstituentNameFix,
    tidemVuf,
    timeToArgoJuld,
    titleCase,
    toEnu,
    toEnuAdp,
    toEnuAdv,
    topoInterpolate,
    # trap, # created by Rcpp
    # trimString, removed 2023-07-12 after a year of deprecated status
    unabbreviateYear,
    undriftTime,
    ungrid,
    unwrapAngle,
    useHeading,
    vectorShow,
    velocityStatistics,
    webtide,
    window.oce,
    woceNames2oceNames,
    write.ctd,
    unduplicateNames,
    unitFromString,
    unitFromStringRsk,
    usrLonLat,
    utm2lonlat,
    xyzToEnu,
    xyzToEnuAdp,
    xyzToEnuAdpAD2CP,
    xyzToEnuAdv
)

S3method(head, oce)
S3method(predict, tidem)
S3method(tail, oce)
S3method(window, oce)

exportClasses(
    oce, adp, adv, amsr, bremen, cm, coastline, ctd, argo, ladp,
    landsat, lisst, lobo, met, odf, sealevel, section, rsk, tidem, topo,
    windrose
)
