@@ -864,7 +864,7 @@ def get_latest_continuous(
864864
865865 >>> # Get monitoring location info for specific sites
866866 >>> # and only specific properties
867- >>> df, md = dataretrieval.waterdata.get_daily (
867+ >>> df, md = dataretrieval.waterdata.get_latest_continuous (
868868 ... monitoring_location_id=["USGS-05114000", "USGS-09423350"]
869869 ... )
870870 """
@@ -881,6 +881,183 @@ def get_latest_continuous(
881881 return get_ogc_data (args , output_id , service )
882882
883883
884+ def get_latest_daily (
885+ monitoring_location_id : Optional [Union [str , List [str ]]] = None ,
886+ parameter_code : Optional [Union [str , List [str ]]] = None ,
887+ statistic_id : Optional [Union [str , List [str ]]] = None ,
888+ properties : Optional [Union [str , List [str ]]] = None ,
889+ time_series_id : Optional [Union [str , List [str ]]] = None ,
890+ latest_daily_id : Optional [Union [str , List [str ]]] = None ,
891+ approval_status : Optional [Union [str , List [str ]]] = None ,
892+ unit_of_measure : Optional [Union [str , List [str ]]] = None ,
893+ qualifier : Optional [Union [str , List [str ]]] = None ,
894+ value : Optional [int ] = None ,
895+ last_modified : Optional [Union [str , List [str ]]] = None ,
896+ skip_geometry : Optional [bool ] = None ,
897+ time : Optional [Union [str , List [str ]]] = None ,
898+ bbox : Optional [List [float ]] = None ,
899+ limit : Optional [int ] = None ,
900+ convert_type : bool = True ,
901+ ) -> Tuple [pd .DataFrame , BaseMetadata ]:
902+ """Daily data provide one data value to represent water conditions for the
903+ day.
904+
905+ Throughout much of the history of the USGS, the primary water data available
906+ was daily data collected manually at the monitoring location once each day.
907+ With improved availability of computer storage and automated transmission of
908+ data, the daily data published today are generally a statistical summary or
909+ metric of the continuous data collected each day, such as the daily mean,
910+ minimum, or maximum value. Daily data are automatically calculated from the
911+ continuous data of the same parameter code and are described by parameter
912+ code and a statistic code. These data have also been referred to as “daily
913+ values” or “DV”.
914+
915+ Parameters
916+ ----------
917+ monitoring_location_id : string or list of strings, optional
918+ A unique identifier representing a single monitoring location. This
919+ corresponds to the id field in the monitoring-locations endpoint.
920+ Monitoring location IDs are created by combining the agency code of the
921+ agency responsible for the monitoring location (e.g. USGS) with the ID
922+ number of the monitoring location (e.g. 02238500), separated by a hyphen
923+ (e.g. USGS-02238500).
924+ parameter_code : string or list of strings, optional
925+ Parameter codes are 5-digit codes used to identify the constituent
926+ measured and the units of measure. A complete list of parameter codes
927+ and associated groupings can be found at
928+ https://help.waterdata.usgs.gov/codes-and-parameters/parameters.
929+ statistic_id : string or list of strings, optional
930+ A code corresponding to the statistic an observation represents.
931+ Example codes include 00001 (max), 00002 (min), and 00003 (mean).
932+ A complete list of codes and their descriptions can be found at
933+ https://help.waterdata.usgs.gov/code/stat_cd_nm_query?stat_nm_cd=%25&fmt=html.
934+ properties : string or list of strings, optional
935+ A vector of requested columns to be returned from the query. Available
936+ options are: geometry, id, time_series_id, monitoring_location_id,
937+ parameter_code, statistic_id, time, value, unit_of_measure,
938+ approval_status, qualifier, last_modified
939+ time_series_id : string or list of strings, optional
940+ A unique identifier representing a single time series. This
941+ corresponds to the id field in the time-series-metadata endpoint.
942+ latest_daily_id : string or list of strings, optional
943+ A universally unique identifier (UUID) representing a single version of
944+ a record. It is not stable over time. Every time the record is refreshed
945+ in our database (which may happen as part of normal operations and does
946+ not imply any change to the data itself) a new ID will be generated. To
947+ uniquely identify a single observation over time, compare the time and
948+ time_series_id fields; each time series will only have a single
949+ observation at a given time.
950+ approval_status : string or list of strings, optional
951+ Some of the data that you have obtained from this U.S. Geological Survey
952+ database may not have received Director's approval. Any such data values
953+ are qualified as provisional and are subject to revision. Provisional
954+ data are released on the condition that neither the USGS nor the United
955+ States Government may be held liable for any damages resulting from its
956+ use. This field reflects the approval status of each record, and is either
957+ "Approved", meaining processing review has been completed and the data is
958+ approved for publication, or "Provisional" and subject to revision. For
959+ more information about provisional data, go to
960+ [https://waterdata.usgs.gov/provisional-data-statement/]
961+ (https://waterdata.usgs.gov/provisional-data-statement/).
962+ unit_of_measure : string or list of strings, optional
963+ A human-readable description of the units of measurement associated
964+ with an observation.
965+ qualifier : string or list of strings, optional
966+ This field indicates any qualifiers associated with an observation, for
967+ instance if a sensor may have been impacted by ice or if values were
968+ estimated.
969+ value : string or list of strings, optional
970+ The value of the observation. Values are transmitted as strings in
971+ the JSON response format in order to preserve precision.
972+ last_modified : string, optional
973+ The last time a record was refreshed in our database. This may happen
974+ due to regular operational processes and does not necessarily indicate
975+ anything about the measurement has changed. You can query this field
976+ using date-times or intervals, adhering to RFC 3339, or using ISO 8601
977+ duration objects. Intervals may be bounded or half-bounded (double-dots
978+ at start or end). Only features that have a last_modified that
979+ intersects the value of datetime are selected.
980+ Examples:
981+ - A date-time: "2018-02-12T23:20:50Z"
982+ - A bounded interval: "2018-02-12T00:00:00Z/2018-03-18T12:31:12Z"
983+ - Half-bounded intervals: "2018-02-12T00:00:00Z/.." or
984+ "../2018-03-18T12:31:12Z"
985+ - Duration objects: "P1M" for data from the past month or "PT36H"
986+ for the last 36 hours
987+ skip_geometry : boolean, optional
988+ This option can be used to skip response geometries for each feature.
989+ The returning object will be a data frame with no spatial information.
990+ Note that the USGS Water Data APIs use camelCase "skipGeometry" in
991+ CQL2 queries.
992+ time : string, optional
993+ The date an observation represents. You can query this field using
994+ date-times or intervals, adhering to RFC 3339, or using ISO 8601
995+ duration objects. Intervals may be bounded or half-bounded (double-dots
996+ at start or end). Only features that have a time that intersects the
997+ value of datetime are selected. If a feature has multiple temporal
998+ properties, it is the decision of the server whether only a single
999+ temporal property is used to determine the extent or all relevant
1000+ temporal properties.
1001+ Examples:
1002+ - A date-time: "2018-02-12T23:20:50Z"
1003+ - A bounded interval: "2018-02-12T00:00:00Z/2018-03-18T12:31:12Z"
1004+ - Half-bounded intervals: "2018-02-12T00:00:00Z/.." or
1005+ "../2018-03-18T12:31:12Z"
1006+ - Duration objects: "P1M" for data from the past month or "PT36H"
1007+ for the last 36 hours
1008+ bbox : list of numbers, optional
1009+ Only features that have a geometry that intersects the bounding box are
1010+ selected. The bounding box is provided as four or six numbers,
1011+ depending on whether the coordinate reference system includes a vertical
1012+ axis (height or depth). Coordinates are assumed to be in crs 4326. The
1013+ expected format is a numeric vector structured: c(xmin,ymin,xmax,ymax).
1014+ Another way to think of it is c(Western-most longitude, Southern-most
1015+ latitude, Eastern-most longitude, Northern-most longitude).
1016+ limit : numeric, optional
1017+ The optional limit parameter is used to control the subset of the
1018+ selected features that should be returned in each page. The maximum
1019+ allowable limit is 10000. It may be beneficial to set this number lower
1020+ if your internet connection is spotty. The default (None) will set the
1021+ limit to the maximum allowable limit for the service.
1022+ convert_type : boolean, optional
1023+ If True, the function will convert the data to dates and qualifier to
1024+ string vector
1025+
1026+ Returns
1027+ -------
1028+ df : ``pandas.DataFrame`` or ``geopandas.GeoDataFrame``
1029+ Formatted data returned from the API query.
1030+ md: :obj:`dataretrieval.utils.Metadata`
1031+ A custom metadata object
1032+
1033+ Examples
1034+ --------
1035+ .. code::
1036+
1037+ >>> # Get daily flow data from a single site
1038+ >>> # over a yearlong period
1039+ >>> df, md = dataretrieval.waterdata.get_latest_daily(
1040+ ... monitoring_location_id="USGS-02238500", parameter_code="00060"
1041+ ... )
1042+
1043+ >>> # Get monitoring location info for specific sites
1044+ >>> # and only specific properties
1045+ >>> df, md = dataretrieval.waterdata.get_latest_daily(
1046+ ... monitoring_location_id=["USGS-05114000", "USGS-09423350"]
1047+ ... )
1048+ """
1049+ service = "latest-daily"
1050+ output_id = "latest_daily_id"
1051+
1052+ # Build argument dictionary, omitting None values
1053+ args = {
1054+ k : v
1055+ for k , v in locals ().items ()
1056+ if k not in {"service" , "output_id" } and v is not None
1057+ }
1058+
1059+ return get_ogc_data (args , output_id , service )
1060+
8841061def get_field_measurements (
8851062 monitoring_location_id : Optional [Union [str , List [str ]]] = None ,
8861063 parameter_code : Optional [Union [str , List [str ]]] = None ,
0 commit comments