NEWS.md
Local data download and table filtering in cc_get_db()
local_data parameter cc_get_db(local_data = TRUE) now downloads parquet files to a local cache directory and creates TABLEs instead of remote VIEWs. Files are only downloaded if missing or if refresh = TRUE, making repeated calls idempotent.tables parameter cc_get_db(tables = c("species", "ichthyo", ...)) filters which tables to load from the catalog. Useful for excluding large tables like CTD data when building app-specific databases.Native GEOMETRY storage in cc_get_db()
storage_compatibility_version = 'latest' cc_get_db() now uses a named DuckDB driver with autoload_known_extensions and latest storage format, matching calcofi4db’s get_duckdb_con() pattern. Ensures native GEOMETRY type is used for spatial queries.Require DuckDB >= 1.5.1 for native GEOMETRY
duckdb >= 1.5.1 Added minimum version constraint to ensure the native built-in GEOMETRY type is available for spatial queries.ERD diagrams render as PNG in Quarto via mermaid-cli
knit_print.cc_erd() now renders Mermaid diagrams to PNG via mmdc (mermaid-cli) at 2x scale with transparent background, saving to knitr::fig_path() for proper Quarto HTML output. Lightbox applies automatically via _quarto.yml settings.mmdc → DiagrammeR::mermaid() htmlwidget → raw mermaid code block.New cc_tbl() unified table accessor
cc_tbl() New function providing unified access to any CalCOFI database table. Returns lazy dplyr::tbl() for non-spatial tables, sf object for spatial tables (via DuckDB EXCLUDE + ST_AsWKB), and pivoted-wide sf for _spatial table (requires layer argument). Optional geom_col selects alternate geometry columns (e.g., geom_ctr for grid centroids).cc_erd() gains a rels parameter to accept pre-parsed relationship lists inline (as alternative to rels_path), matching the calcofi4db build_relationships_json() list format.knit_print.cc_erd() now outputs raw mermaid code blocks for Quarto native rendering (respects mermaid-format: png and lightbox settings in _quarto.yml) instead of rendering via DiagrammeR widget.ctd_measurement (15 GB) partitioned by cruise_key, in online DuckDB for improved performance and scalability.cc_get_db(), cc_list_versions()
casts_extra: cc_make_view(), cc_list_view_templates()
cc_read_sf() to read spatial tables in DuckDB connection as sf objects.cc_get_db() as the main entry pointcc_read_larvae()cc_read_bottle()cc_read_cast()cc_list_versions()
cc_query() and cc_describe_table()
Migrated functions.R from CalCOFI Integrated Assessment Shiny App that utilizes a local or remote duckdb of CalCOFI data (rather than an API).
TODO: add @concept to functions (to move out of Other heading in Reference) and build vignette (like Get started) demonstrating use of these new functions.
cc_db_catalog() to list tables and columns in the database with descriptions (possibly formatted in markdown) by reading from new CalCOFI API endpoints: api.calcofi.io/db_tables, api.calcofi.io/db_columns.Removed non-ASCII characters to allow install of package on Windows.
Used stars::st_as_stars() to use terra::rast() SpatRaster with mapview::mapView() (vs retired raster::raster()).
Added interpolation functions pts_to_rast_idw() and rast_to_contours(). Renamed map_contours() to pts_to_contours_gam() and moved concept from “visualize” to “analyze”.
Added to cc_places:
cc_db_connect() and create_index().cc_grid to include sta_pos == 60. Renamed cc_grid_areas to cc_grid_zones with new categories for sta_shore (“nearshore” OR “offshore”) and sta_pattern (“standard”, “extended”, “historical”) per #4. Updated cc_places to have the 6 combinations of cc_grid_zones.cc_places with three categories for places: 1) CalCOFI (Core, Extended, Nearshore, Offshore); 2) Integrated Ecosystem Assessment (California Current); and 3) National Marine Sanctuary (Cordell Bank, Channel Islands, Greater Farallones, Monterey Bay, Olympic Coast). Augmented cc_grid* with missing cells to reduce slivers when intersecting.cc_grid_area -> cc_grid_areas data for showing study areas with combinations of sta_dpos nearshore (5), offshore (10) and outside (20); where area_dpos can be one of: "5", "10", "20", "5,10", "10,20" or "5,10,20"
cc_grid, cc_grid_ctrs showing the CalCOFI station sampling at varying seperation distances of station positions (sta_pos) in the CalCOFI coordinate system from nearshore (5), to offshore (10) to outside the 113 station extended repeated area (20), per Station Positions – CalCOFI}plot_depth(), streamline headings in article and descriptions in functionsplot_depth() and example data bottle_temp_depth
stations_t_degc -> bottle_temp_lonlat
get_cruises() and get_raster() for reading from the CalCOFI API.map_raster() and plot_timeseries() for visualizing.get_variables(), get_timeseries() for reading from the API at https://api.calcofi.io
get_oceano_var_aoi()) and Visualize (plot_timeseries()), plus Data (bottle, dic, stations).