def get_wqp_results(self, service, **kwargs):
"""Bring data from WQP site into a Pandas DataFrame for analysis"""
# set data types
Rdtypes = {"OrganizationIdentifier": np.str_, "OrganizationFormalName": np.str_, "ActivityIdentifier": np.str_,
"ActivityStartTime/Time": np.str_,
"ActivityTypeCode": np.str_, "ActivityMediaName": np.str_, "ActivityMediaSubdivisionName": np.str_,
"ActivityStartDate": np.str_, "ActivityStartTime/TimeZoneCode": np.str_,
"ActivityEndDate": np.str_, "ActivityEndTime/Time": np.str_, "ActivityEndTime/TimeZoneCode": np.str_,
"ActivityDepthHeightMeasure/MeasureValue": np.float16,
"ActivityDepthHeightMeasure/MeasureUnitCode": np.str_,
"ActivityDepthAltitudeReferencePointText": np.str_,
"ActivityTopDepthHeightMeasure/MeasureValue": np.float16,
"ActivityTopDepthHeightMeasure/MeasureUnitCode": np.str_,
"ActivityBottomDepthHeightMeasure/MeasureValue": np.float16,
"ActivityBottomDepthHeightMeasure/MeasureUnitCode": np.str_,
"ProjectIdentifier": np.str_, "ActivityConductingOrganizationText": np.str_,
"MonitoringLocationIdentifier": np.str_, "ActivityCommentText": np.str_,
"SampleAquifer": np.str_, "HydrologicCondition": np.str_, "HydrologicEvent": np.str_,
"SampleCollectionMethod/MethodIdentifier": np.str_,
"SampleCollectionMethod/MethodIdentifierContext": np.str_,
"SampleCollectionMethod/MethodName": np.str_, "SampleCollectionEquipmentName": np.str_,
"ResultDetectionConditionText": np.str_, "CharacteristicName": np.str_,
"ResultSampleFractionText": np.str_,
"ResultMeasureValue": np.str_, "ResultMeasure/MeasureUnitCode": np.str_,
"MeasureQualifierCode": np.str_,
"ResultStatusIdentifier": np.str_, "StatisticalBaseCode": np.str_, "ResultValueTypeName": np.str_,
"ResultWeightBasisText": np.str_, "ResultTimeBasisText": np.str_,
"ResultTemperatureBasisText": np.str_,
"ResultParticleSizeBasisText": np.str_, "PrecisionValue": np.str_, "ResultCommentText": np.str_,
"USGSPCode": np.str_, "ResultDepthHeightMeasure/MeasureValue": np.float16,
"ResultDepthHeightMeasure/MeasureUnitCode": np.str_,
"ResultDepthAltitudeReferencePointText": np.str_,
"SubjectTaxonomicName": np.str_, "SampleTissueAnatomyName": np.str_,
"ResultAnalyticalMethod/MethodIdentifier": np.str_,
"ResultAnalyticalMethod/MethodIdentifierContext": np.str_,
"ResultAnalyticalMethod/MethodName": np.str_, "MethodDescriptionText": np.str_,
"LaboratoryName": np.str_,
"AnalysisStartDate": np.str_, "ResultLaboratoryCommentText": np.str_,
"DetectionQuantitationLimitTypeName": np.str_,
"DetectionQuantitationLimitMeasure/MeasureValue": np.str_,
"DetectionQuantitationLimitMeasure/MeasureUnitCode": np.str_, "PreparationStartDate": np.str_,
"ProviderName": np.str_}
# define date field indices
dt = [6, 56, 61]
csv = self.get_response(service, **kwargs).url
print(csv)
# read csv into DataFrame
df = pd.read_csv(csv, dtype=Rdtypes, parse_dates=dt)
return df
评论列表
文章目录