Changelog
Source:NEWS.md
preMetabolizer 0.0.0.9000
Package vignettes that query live meteorological services now require
PREMETABOLIZER_RUN_VIGNETTES=true; package checks and installations are offline by default.calc_cv()andcalc_mode()now validate their logical and tie-handling arguments before doing any calculations (no issue).calc_water_height()andcorrect_bp()now validate numeric inputs and reject incompatible atmospheric-pressure lengths with actionable errors (no issue).Kansas Mesonet helpers now use HTTPS and share a bounded retrying request builder (no issue).
calc_exceedance_prob()andrcpp_calc_exceedance_prob()now error whenremove_zerosis not a singleTRUEorFALSE; previously logical vectors andNAwere accepted (no issue).calc_exceedance_prob()andrcpp_calc_exceedance_prob()rename theflowargument tovaluesand therm.zeroargument toremove_zeros. Therm.zeroargument is deprecated and will be removed in a future release (no issue).cdo_data(),cdo_datasets(),cdo_data_categories(),cdo_data_types(),cdo_location_categories(),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).cdo_data_categories(),cdo_data_types(), andcdo_location_categories()replacecdo_datacategories(),cdo_datatypes(), andcdo_locationcategories()for tidyverse-style naming; the old names are soft-deprecated (no issue).cdo_data(),cdo_datasets(),cdo_data_categories(),cdo_data_types(),cdo_location_categories(),cdo_locations(), andcdo_stations()rename their NOAA-API-style arguments (datasetid,datatypeid,locationid,stationid,datacategoryid,locationcategoryid,startdate,enddate,sortfield,sortorder,includemetadata) todataset_id,datatype_id,location_id,station_id,data_category_id,location_category_id,start_date,end_date,sort_field,sort_order, andinclude_metadata; the old argument names are soft-deprecated (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).closest_noaa_stations(),get_noaa_stations(), andncei_stations()again return station coordinates: the NCEI Search API changed itscentroidfield from an object to a bare longitude/latitude array, which made every coordinateNAand causedclosest_noaa_stations()to returnNULL(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_nasa_data()works with newer nasapower versions again: nasapower hourly output replaced theYYYYMMDDcolumn with separateYEAR,MO, andDYcolumns, which caused an error when assembling timestamps after the download completed (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).get_usgs_elev()now retries transient server and network failures, validates elevation responses more strictly, limits queries to four concurrent requests, and can return USGS response metadata withdetails = TRUE(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).plot_metab_data()creates a five-panel time-series plot of dissolved oxygen, saturation, depth, water temperature, and light from stream metabolism input data (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_ar_sat()(formerlycalc_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_ch4_sat()(formerlycalc_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_mol_kg()andcalc_co2_mg_l()(formerlycalc_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_mol_kg()andcalc_co2_mg_l()rename thewaterDepth_margument towater_depth_m;waterDepth_mis soft-deprecated (no issue).calc_co2_sat()(formerlycalc_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_ar_sat(),calc_ch4_sat(),calc_co2_mol_kg(),calc_co2_mg_l(),calc_co2_sat(),calc_n2o_sat(), andxco2_to_pco2()/pco2_to_xco2()rename their chemistry/unit arguments (xCH4_ppm,CO2_ppm,xCO2_ppm,xN2O_ppm,pCO2_uatm) toxch4_ppm,co2_ppm,xco2_ppm,xn2o_ppm, andpco2_uatmfor tidyverse-style naming; the old argument names are soft-deprecated (no issue).calc_exceedance_prob()gains analphaargument for the plotting position constant in the general formula of Cunnane (1978); the defaultalpha = 0keeps the Weibull plotting position (no issue).calc_exceedance_prob()now treats infinite values asNAinstead of erroring (no issue).calc_k0()(formerlycalc_K0()) renames thewaterDepth_margument towater_depth_m;waterDepth_mis soft-deprecated (no issue).calc_n2o_sat()(formerlycalc_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_n2_sat()(formerlycalc_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_o2_sat()gains anout_unitsargument to return saturation in umol/L in addition to mg/L (no issue).calc_o2_sat()(formerlycalc_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.xco2_to_pco2()andpco2_to_xco2()(formerlyxCO2_to_pCO2()andpCO2_to_xCO2()) convert between CO2 mole fraction and water-vapor-corrected partial pressure (no issue).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.calc_water_height()renames thesensor_kPaandatmo_kPaarguments tosensor_kpaandatmo_kpa;sensor_kPaandatmo_kPaare soft-deprecated (no issue).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).even_timesteps()now returns evenly spaced, rounded timestamps with values linearly interpolated onto the new grid: the grid is aligned to the inferred time step (e.g. a series of 10-minute readings starting at 20:59 yields 21:00, 21:10, …) and only the grid timestamps are returned. Previously the original timestamps were kept and missing steps were inserted asNArows (no issue).even_timesteps()gains amax_gapargument giving the maximum gap in seconds across which values are interpolated; grid timestamps inside wider gaps are leftNA. It defaults to 1.5 times the inferred time step, which bridges ordinary clock offsets while leaving missing readings asNA. Non-numeric columns cannot be interpolated and are filled from the nearest observation, with a warning (no issue).even_timesteps()now builds grids with whole-second arithmetic, rounds both grid boundaries to the nearest inferred step, handles duplicated and clock-jittered timestamps, preserves daily local-midnight grids across daylight saving time transitions, drops rows with missing timestamps or site values with warnings, and drops sites whose time step cannot be inferred instead of returning raw off-grid rows (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_ob_history(),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).iem_ob_history()replacesiem_obhistory()for tidyverse-style naming;iem_obhistory()is soft-deprecated (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_time_series()replacesks_meso_timeseries()for tidyverse-style naming;ks_meso_timeseries()is soft-deprecated (no issue).ks_meso_time_series()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()gains analphaargument for the plotting position constant, matchingcalc_exceedance_prob()(no issue).rcpp_calc_exceedance_prob()now provides a C++ implementation of exceedance probability calculations (no issue).rcpp_calc_exceedance_prob()now treats infinite values asNAinstead of erroring, matchingcalc_exceedance_prob()(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_time_series()can now retrieve Texas Water Development Board station metadata, current observations, and recent station time-series data from TexMesonet (no issue).tex_meso_time_series()replacestex_meso_timeseries()for tidyverse-style naming;tex_meso_timeseries()is soft-deprecated (no issue).