@@ -258,7 +258,11 @@ def what_organizations(
258258 if legacy is True :
259259 url = wqp_url ("Organization" )
260260 else :
261- print ("WQX3.0 profile not available, returning legacy profile." )
261+ warnings .warn (
262+ "WQX3.0 profile not available, returning legacy profile." ,
263+ UserWarning ,
264+ stacklevel = 2 ,
265+ )
262266 url = wqp_url ("Organization" )
263267
264268 response = query (url , payload = kwargs , delimiter = ";" , ssl_check = ssl_check )
@@ -309,7 +313,11 @@ def what_projects(ssl_check=True, legacy=True, **kwargs):
309313 if legacy is True :
310314 url = wqp_url ("Project" )
311315 else :
312- print ("WQX3.0 profile not available, returning legacy profile." )
316+ warnings .warn (
317+ "WQX3.0 profile not available, returning legacy profile." ,
318+ UserWarning ,
319+ stacklevel = 2 ,
320+ )
313321 url = wqp_url ("Project" )
314322
315323 response = query (url , payload = kwargs , delimiter = ";" , ssl_check = ssl_check )
@@ -435,7 +443,11 @@ def what_detection_limits(
435443 if legacy is True :
436444 url = wqp_url ("ResultDetectionQuantitationLimit" )
437445 else :
438- print ("WQX3.0 profile not available, returning legacy profile." )
446+ warnings .warn (
447+ "WQX3.0 profile not available, returning legacy profile." ,
448+ UserWarning ,
449+ stacklevel = 2 ,
450+ )
439451 url = wqp_url ("ResultDetectionQuantitationLimit" )
440452
441453 response = query (url , payload = kwargs , delimiter = ";" , ssl_check = ssl_check )
@@ -490,7 +502,11 @@ def what_habitat_metrics(
490502 if legacy is True :
491503 url = wqp_url ("BiologicalMetric" )
492504 else :
493- print ("WQX3.0 profile not available, returning legacy profile." )
505+ warnings .warn (
506+ "WQX3.0 profile not available, returning legacy profile." ,
507+ UserWarning ,
508+ stacklevel = 2 ,
509+ )
494510 url = wqp_url ("BiologicalMetric" )
495511
496512 response = query (url , payload = kwargs , delimiter = ";" , ssl_check = ssl_check )
@@ -516,7 +532,7 @@ def what_project_weights(ssl_check=True, legacy=True, **kwargs):
516532 ssl_check : bool
517533 Check the SSL certificate. Default is True.
518534 legacy : bool
519- Retrun the legacy WQX data profile. Default is True.
535+ Return the legacy WQX data profile. Default is True.
520536 **kwargs : optional
521537 Accepts the same parameters as :obj:`dataretrieval.wqp.get_results`
522538
@@ -546,7 +562,11 @@ def what_project_weights(ssl_check=True, legacy=True, **kwargs):
546562 if legacy is True :
547563 url = wqp_url ("ProjectMonitoringLocationWeighting" )
548564 else :
549- print ("WQX3.0 profile not available, returning legacy profile." )
565+ warnings .warn (
566+ "WQX3.0 profile not available, returning legacy profile." ,
567+ UserWarning ,
568+ stacklevel = 2 ,
569+ )
550570 url = wqp_url ("ProjectMonitoringLocationWeighting" )
551571
552572 response = query (url , payload = kwargs , delimiter = ";" , ssl_check = ssl_check )
@@ -602,12 +622,16 @@ def what_activity_metrics(ssl_check=True, legacy=True, **kwargs):
602622 if legacy is True :
603623 url = wqp_url ("ActivityMetric" )
604624 else :
605- print ("WQX3.0 profile not available, returning legacy profile." )
625+ warnings .warn (
626+ "WQX3.0 profile not available, returning legacy profile." ,
627+ UserWarning ,
628+ stacklevel = 2 ,
629+ )
606630 url = wqp_url ("ActivityMetric" )
607631
608632 response = query (url , payload = kwargs , delimiter = ";" , ssl_check = ssl_check )
609633
610- df = pd .read_csv (StringIO (response .text ), delimiter = "," )
634+ df = pd .read_csv (StringIO (response .text ), delimiter = "," , low_memory = False )
611635
612636 return df , WQP_Metadata (response )
613637
@@ -619,9 +643,8 @@ def wqp_url(service):
619643 _warn_legacy_use ()
620644
621645 if service not in services_legacy :
622- raise TypeError (
623- "Legacy service not recognized. Valid options are" ,
624- f"{ services_legacy } ." ,
646+ raise ValueError (
647+ f"Legacy service not recognized. Valid options are { services_legacy } ."
625648 )
626649
627650 return f"{ base_url } { service } /Search?"
@@ -634,9 +657,8 @@ def wqx3_url(service):
634657 _warn_wqx3_use ()
635658
636659 if service not in services_wqx3 :
637- raise TypeError (
638- "WQX3.0 service not recognized. Valid options are" ,
639- f"{ services_wqx3 } ." ,
660+ raise ValueError (
661+ f"WQX3.0 service not recognized. Valid options are { services_wqx3 } ."
640662 )
641663
642664 return f"{ base_url } { service } /search?"
@@ -708,7 +730,7 @@ def _check_kwargs(kwargs):
708730def _warn_wqx3_use ():
709731 message = (
710732 "Support for the WQX3.0 profiles is experimental. "
711- "Queries may be slow or fail intermitttently ."
733+ "Queries may be slow or fail intermittently ."
712734 )
713735 warnings .warn (message , UserWarning , stacklevel = 2 )
714736
0 commit comments