Changelog
Source:NEWS.md
preMetabolizer 0.0.0.9000
cdo_data(),cdo_datasets(),cdo_datacategories(),cdo_datatypes(),cdo_locationcategories(),cdo_locations(), andcdo_stations()wrap the seven endpoints of the NCEI Climate Data Online (CDO) Web Services v2 API; they auto-paginate, parse date and numeric columns, read the API token from theAPI_NCEI_CDOenvironment variable, throttle to the per-token limit of 5 requests per second, and abort once the 10,000 requests-per-day limit is reached for the session (usecdo_request_count()to inspect andcdo_reset_request_count()to clear the session counter) (no issue).closest_noaa_stations()now queries the NCEI Search API with a bounding box instead of downloading the full MSHR station archive; thestateandcleanarguments have been removed (no issue).download_ghcnh()andread_ghcnh()have been replaced byget_ghcnh(), which downloads GHCNh files and returns a parsed tibble directly (no issue).get_ghcnh()now uses the GHCNh v1.1.0 archive with per-year PSV files; it can retrieve data for multiple stations in parallel, accepts a date range instead of individual years, and returns column names insnake_case(no issue).get_noaa_ghg()downloads the NOAA Global Monitoring Laboratory globally averaged monthly mean records for CO2, CH4, N2O, and SF6 and returns them stacked long with agaslabel, a mid-monthdate, and aunitcolumn; each gas is reported in its standard NOAA unit by default (CO2 in ppm, CH4 and N2O in ppb, SF6 in ppt), or passunits("ppm","ppb", or"ppt") to convert every gas to a common unit;-9.99uncertainty sentinels are read asNA(no issue).get_noaa_stations()now queries the NCEI Search API for GHCND stations instead of parsing the MSHR fixed-width archive; it acceptsbbox,start_date,end_date,data_types, andtextarguments; thestate,clean, anddebugarguments have been removed (no issue).ncei_bbox()computes a bounding box from a centre latitude, longitude, and radius in kilometres (no issue).ncei_data()can retrieve data from any NCEI dataset (e.g.,"daily-summaries","global-hourly") via the NCEI Access Data Service API (no issue).ncei_datasets()retrieves metadata about an NCEI dataset from the Support Service API (no issue).ncei_stations()searches for stations across any NCEI dataset via the NCEI Search Service API, with optional bounding box, date range, and data type filters (no issue).Added
french_creekdataset: 5-minute dissolved oxygen and water temperature records from French Creek, Laramie, WY (Aug–Sep 2012), courtesy of Bob Hall. Source: Hall et al. (2016), .Added “Preparing French Creek Data for Stream Metabolism Modeling” vignette demonstrating a complete preMetabolizer workflow: solar time conversion, modeled PAR, elevation-corrected barometric pressure, O2 saturation, and streamMetabolizer input assembly.
Data-download helpers now throttle HTTP requests and use bounded parallel request execution to avoid sending too many simultaneous requests to remote services (no issue).
Mesonet helpers now return snake_case table columns and use consistent station and network identifiers such as
station_id,station_name,network, andnetwork_nameacross Kansas Mesonet, TexMesonet, and IEM results (no issue).Messages, warnings, and errors now consistently use cli formatting across the package (no issue).
calc_Arsat()calculates dissolved argon saturation (the concentration in equilibrium with the atmosphere) from water temperature, barometric pressure, and salinity using the Hamme and Emerson (2004) solubility fit, returning umol/L or mg/L (no issue).calc_bin_width()withmethod = "doane"now uses a self-consistent population skewness estimator; the previous formula mixed a population third moment with the sample standard deviation, biasing the bin width for small samples (no issue).calc_CH4sat()calculates dissolved methane saturation (the concentration in equilibrium with the atmosphere) from water temperature, barometric pressure, and salinity using Wiesenburg and Guinasso (1979), returning umol/L or mg/L (no issue).calc_CO2_molKg()andcalc_CO2_mgL()now follow the standard Henry’s law form[CO2*] = K0 * pCO2. A spurious additional factor of total pressure (atmospheric + hydrostatic) previously under-reported dissolved CO2 at any site away from 1 atm; the error reached ~15% at typical high-elevation streams (no issue).calc_CO2_molKg()andcalc_CO2_mgL()rename thewaterDepth_margument towater_depth_m;waterDepth_mis soft-deprecated (no issue).calc_CO2sat()calculates dissolved carbon dioxide saturation (the concentration in equilibrium with the atmosphere) using the Weiss and Price (1980) trace-gas solubility function, returning umol/L or mg/L (no issue).calc_K0()renames thewaterDepth_margument towater_depth_m;waterDepth_mis soft-deprecated (no issue).calc_N2Osat()calculates dissolved nitrous oxide saturation (the concentration in equilibrium with the atmosphere) using the Weiss and Price (1980) trace-gas solubility function, returning umol/L or mg/L (no issue).calc_N2sat()calculates dissolved nitrogen (N2) saturation (the concentration in equilibrium with the atmosphere) from water temperature, barometric pressure, and salinity using the Hamme and Emerson (2004) solubility fit, returning umol/L or mg/L (no issue).calc_O2sat()gains anout_unitsargument to return saturation in umol/L in addition to mg/L (no issue).calc_O2sat()now uses the Benson and Krause umol/kg coefficients from Garcia and Gordon (1992), converts to mg/L with salinity-aware density, and applies the corrected vapor-pressure term for non-standard pressure (no issue).calc_vapor_press()withmethod = "MIMSY"now returns physically correct values. The Antoine equation constantBwas incorrectly set to 140.264 (should be 1435.264), causing vapor pressures that were orders of magnitude too large.calc_water_density()gains asalinityargument: freshwater (salinity = 0) uses the Tanaka et al. (2001) recommended pure-water (SMOW) equation up to 40°C and Kell (1975) above 40°C (to 150°C), and any nonzero salinity uses the Millero and Poisson (1981) one-atmosphere seawater equation of state (valid 0-40°C and salinity 0.5-43), warning when temperature or salinity falls outside the valid range of the equation used. The gas-saturation functions now share this single density helper instead of a private copy (no issue).calc_water_density()no longer accepts a.drop_unitsargument; it always returns a plain numeric vector (no issue).calc_water_height()now gives a clear error whentype = "unvented"is used without providingatmo_kPa, rather than silently returningNA.closest_noaa_stations()no longer accepts the deprecatedlat,long, orlonarguments; uselatitudeandlongitude. The returned tibble usesstation_nameand no longer includes always-NAelevationordata_coveragecolumns (no issue).get_ghcnh()internals now share datetime parsing with the mesonet helpers and use the sharedcheck_*input validators (no issue).get_ghcnh()no longer errors withobject 'sid' not foundwhen called withquiet = FALSE(no issue).get_noaa_stations()returns a tibble withstation_nameand no longer includes always-NAelevationordata_coveragecolumns (no issue).ncei_data()returns a snake_case tibble led bystation_id,station_name, and a parseddatetime(ordate) column; fordataset = "global-hourly"the ISD mandatory fields (WND,CIG,VIS,TMP,DEW,SLP,AA1–AA4) are split into typed numeric columns with units applied and sentinels converted toNA(no issue).ncei_stations()returns a tibble withstation_name; the always-NAelevationanddata_coveragecolumns are removed (no issue).convert_flow()now requires an explicitfromargument specifying the input unit; it always returns a plain numeric vector instead of aunitsobject (no issue).convert_PAR_to_SW()andconvert_SW_to_PAR()are no longer re-exported from preMetabolizer. CallstreamMetabolizer::convert_PAR_to_SW()andstreamMetabolizer::convert_SW_to_PAR()directly (no issue).convert_to_solar_time()andconvert_from_solar_time()replaceconvert_UTC_to_solartime()andconvert_solartime_to_UTC(). The new functions use the standard 15 deg/hour longitude offset for mean solar time and delegate toSunCalcMeeus::solar_time()for apparent solar time. They are renamed to avoid shadowing the originals instreamMetabolizer, which can still be called directly when needed (no issue).convert_to_solar_time()renames thedateTimeargument todate_time;dateTimeis soft-deprecated (no issue).convert_to_solar_time()andconvert_from_solar_time()now accept a vectorlongitude(one site per timestamp), so apparent solar time can be computed for several sites in a single call rather than erroring insideSunCalcMeeus(no issue).calc_light()now computes the solar zenith angle viaSunCalcMeeus::sun_zenith_angle()(full Meeus algorithms) instead of an internal first-order declination approximation. The public signature is unchanged; PAR values shift by less than ~0.03 percent. The internal helperscalc_solar_insolation(),calc_declination_angle(),calc_hour_angle(),calc_zenith_angle(),to_radians(), andto_degrees()have been removed (no issue).calc_light()no longer routes PAR throughstreamMetabolizer::convert_PAR_to_SW()andstreamMetabolizer::convert_SW_to_PAR(). Those wrappers ultimately callLakeMetabolizer::par.to.sw.base()andsw.to.par.base(), which are constant-factor multiplications by 0.473 and 2.114 respectively; because the factors are reciprocals the round-trip cancels exactly, so the conversion has been inlined asmax.PAR * cos(zenith)(no issue).get_nasa_data()inlines the SW-to-PAR conversion (SW * 2.114, Britton and Dodd 1976) instead of callingstreamMetabolizer::convert_SW_to_PAR(). Output values are unchanged (no issue).streamMetabolizeris no longer a hard dependency of preMetabolizer. It has been removed fromImports:andRemotes:, and install it separately if you intend to fit metabolism models on the prepared data. Itsconvert_UTC_to_solartime()andconvert_solartime_to_UTC()are still callable via thestreamMetabolizer::prefix (no issue).calc_par()replacescalc_light()to avoid shadowingstreamMetabolizer::calc_light(). The function body and behaviour are unchanged; parameterssolar.timeandmax.PARwere renamed tosolar_timeandmax_parto use the package’s underscore convention (no issue).calc_par()now accepts vectorlatitudeandlongitude(one site per timestamp) so several sites can be modeled in a single call, and errors clearly when a coordinate length is neither 1 nor the number of timestamps (no issue).convert_pressure()now requires an explicitfromargument; it always returns a plain numeric vector. Unit-bearing objects are no longer accepted as input.convert_pressure()is now the sole public pressure conversion helper;convert_pressure_to_atm()has been removed (no issue).correct_bp()no longer accepts adrop_unitsargument; it always returns a plain numeric vector. Elevation inputs must be plain numeric (meters) (no issue).download_ghcnh()now validates inputs more clearly, treats existing local files as skipped downloads, and reports skipped files in its summary (no issue).even_timesteps()no longer errors on single-column data frames due todrop = TRUEsubsetting.even_timesteps()now infers the time step from the modal diff of timestamps rather than the first diff, so a single near-duplicate timestamp at the start of a series no longer causes a wrong (often much smaller) step to be inferred (no issue).even_timesteps()renames theloggerDataargument tologger_data;loggerDatais soft-deprecated (no issue).even_timesteps()now detects the POSIXct datetime column automatically;datetime_coldefaults toNULLand only needs to be supplied whenlogger_datacontains multiple POSIXct columns (no issue).flag_z()now uses the canonical Tukey biweight midvariance (Mosteller & Tukey 1977; Lax 1985) with tuning constantc = 9for the robust scale estimate, instead of a non-canonical MAD-normalized weighted standard deviation. The returned z-scores are now comparable to a Gaussian z for normally distributed data (no issue).get_nasa_data()now accepts time-series data directly, infers per-site download date ranges from the data, uses either single-sitelatitudeandlongitudearguments or per-sitelatitude,longitude, andelev_mcolumns, interpolates NASA values to the input timestamps, returnslight.obsby convertingALLSKY_SFC_SW_DWNwithstreamMetabolizer::convert_SW_to_PAR(), and runs quietly by default. The oldlatandlonaliases are deprecated (no issue).get_nasa_data()now detects the date-time column automatically;datetime_coldefaults toNULLand only needs to be supplied whendatacontains multiple POSIXct or Date columns (no issue).get_noaa_stations()now filters cached raw station metadata bystate, validates options more clearly, and uses cached station metadata when remote modification times are unavailable (no issue).get_season()now uses the per-year astronomical equinox and solstice dates (computed via Meeus, Astronomical Algorithms, 1991, chapter 26) instead of fixed month-day breakpoints, gainshemisphereandlabelsarguments, returns an ordered factor with levels Spring < Summer < Autumn < Winter, and uses “Autumn” instead of “Fall” as the default label (no issue).get_usgs_elev()can now retrieve elevation values from the USGS Elevation Point Query Service for one or more coordinate pairs (no issue).has_units()has been removed. Theunitspackage is no longer a dependency (no issue).iem_current(),iem_daily(),iem_networks(),iem_obhistory(),iem_station(), andiem_stations()can now retrieve Iowa Environmental Mesonet network metadata, station metadata, current observations, one-day observation histories, and daily summaries (no issue).ks_meso_fw13()can now retrieve Kansas Mesonet fire weather data in FW13 format for one station and date range (no issue).ks_meso_most_recent()can now retrieve the most recently ingested Kansas Mesonet timestamp for each station at a requested interval (no issue).ks_meso_timeseries()can now retrieve Kansas Mesonet station or network observations directly without writing to or reading from a local cache. The oldget_ks_meso()andread_ks_meso()cache-oriented helpers have been removed before production release (no issue).rcpp_calc_exceedance_prob()now provides a C++ implementation of flow exceedance probability calculations (no issue).read_ghcnh()is now exported, validates file inputs, can suppress progress messages withquiet = TRUE, and handles files that lackStation_nameorStation_IDcolumns (no issue).tex_meso_stations(),tex_meso_current(), andtex_meso_timeseries()can now retrieve Texas Water Development Board station metadata, current observations, and recent station time-series data from TexMesonet (no issue).