afscgap

Library which allows for Pythonic access to the interacting with AFSC GAP.

This library supports Pythonic utilization of the API for the Ground Fish Assessment Program (GAP), a dataset produced by the Resource Assessment and Conservation Engineering (RACE) Division of the Alaska Fisheries Science Center (AFSC) as part of the National Oceanic and Atmospheric Administration (NOAA Fisheries). Note that this is a community-provided library and is not officially endorsed by NOAA.

(c) 2023 Regents of University of California / The Eric and Wendy Schmidt Center for Data Science and the Environment at UC Berkeley.

This file is part of afscgap released under the BSD 3-Clause License. See LICENSE.md.

   1"""Library which allows for Pythonic access to the interacting with AFSC GAP.
   2
   3This library supports Pythonic utilization of the API for the Ground
   4Fish Assessment Program (GAP), a dataset produced by the Resource Assessment
   5and Conservation Engineering (RACE) Division of the Alaska Fisheries Science
   6Center (AFSC) as part of the National Oceanic and Atmospheric Administration
   7(NOAA Fisheries). Note that this is a community-provided library and is not
   8officially endorsed by NOAA.
   9
  10(c) 2023 Regents of University of California / The Eric and Wendy Schmidt Center
  11for Data Science and the Environment at UC Berkeley.
  12
  13This file is part of afscgap released under the BSD 3-Clause License. See
  14LICENSE.md.
  15"""
  16import typing
  17import warnings
  18
  19import afscgap.client
  20import afscgap.inference
  21import afscgap.model
  22
  23from afscgap.typesdef import FLOAT_PARAM
  24from afscgap.typesdef import INT_PARAM
  25from afscgap.typesdef import STR_PARAM
  26
  27from afscgap.typesdef import OPT_FLOAT
  28from afscgap.typesdef import OPT_INT
  29from afscgap.typesdef import OPT_STR
  30from afscgap.typesdef import OPT_REQUESTOR
  31
  32from afscgap.inference import OPT_HAUL_LIST
  33
  34WARN_FUNCTION = typing.Optional[typing.Callable[[str], None]]
  35
  36LARGE_WARNING = ' '.join([
  37    'Your query may return a very large amount of records.',
  38    'Be sure to interact with results in a memory efficient way.'
  39])
  40
  41
  42class Query:
  43    """Entrypoint for the AFSC GAP Python library.
  44
  45    Facade for executing queries against AFSC GAP and builder to create those
  46    queries.
  47    """
  48
  49    def __init__(self, base_url: OPT_STR = None, hauls_url: OPT_STR = None,
  50        requestor: OPT_REQUESTOR = None):
  51        """Create a new Query.
  52
  53        Args:
  54            base_url: The URL at which the API can be found. If None, will use
  55                default (offical URL at time of release). See
  56                afscgap.client.DEFAULT_URL.
  57            hauls_url: The URL at which the flat file with hauls metadata can be
  58                found or None if a default should be used. Defaults to None.
  59            requestor: Strategy to use for making HTTP requests. If None, will
  60                use a default as defined by afscgap.client.Cursor.
  61        """
  62        # URLs for data
  63        self._base_url = base_url
  64        self._hauls_url = hauls_url
  65        self._requestor = requestor
  66
  67        # Filter parameters
  68        self._year: FLOAT_PARAM = None
  69        self._srvy: STR_PARAM = None
  70        self._survey: STR_PARAM = None
  71        self._survey_id: FLOAT_PARAM = None
  72        self._cruise: FLOAT_PARAM = None
  73        self._haul: FLOAT_PARAM = None
  74        self._stratum: FLOAT_PARAM = None
  75        self._station: STR_PARAM = None
  76        self._vessel_name: STR_PARAM = None
  77        self._vessel_id: FLOAT_PARAM = None
  78        self._date_time: STR_PARAM = None
  79        self._latitude_dd: FLOAT_PARAM = None
  80        self._longitude_dd: FLOAT_PARAM = None
  81        self._species_code: FLOAT_PARAM = None
  82        self._common_name: STR_PARAM = None
  83        self._scientific_name: STR_PARAM = None
  84        self._taxon_confidence: STR_PARAM = None
  85        self._cpue_kgha: FLOAT_PARAM = None
  86        self._cpue_kgkm2: FLOAT_PARAM = None
  87        self._cpue_kg1000km2: FLOAT_PARAM = None
  88        self._cpue_noha: FLOAT_PARAM = None
  89        self._cpue_nokm2: FLOAT_PARAM = None
  90        self._cpue_no1000km2: FLOAT_PARAM = None
  91        self._weight_kg: FLOAT_PARAM = None
  92        self._count: FLOAT_PARAM = None
  93        self._bottom_temperature_c: FLOAT_PARAM = None
  94        self._surface_temperature_c: FLOAT_PARAM = None
  95        self._depth_m: FLOAT_PARAM = None
  96        self._distance_fished_km: FLOAT_PARAM = None
  97        self._net_width_m: FLOAT_PARAM = None
  98        self._net_height_m: FLOAT_PARAM = None
  99        self._area_swept_ha: FLOAT_PARAM = None
 100        self._duration_hr: FLOAT_PARAM = None
 101        self._tsn: INT_PARAM = None
 102        self._ak_survey_id: INT_PARAM = None
 103
 104        # Query pararmeters
 105        self._limit: OPT_INT = None
 106        self._start_offset: OPT_INT = None
 107        self._filter_incomplete: bool = False
 108        self._presence_only: bool = True
 109        self._suppress_large_warning: bool = False
 110        self._warn_function: WARN_FUNCTION = None
 111        self._hauls_prefetch: OPT_HAUL_LIST = None
 112
 113    def filter_year(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 114        max_val: OPT_FLOAT = None) -> 'Query':
 115        """Filter on year for the survey in which this observation was made.
 116
 117        Filter on year for the survey in which this observation was made,
 118        ovewritting all prior year filters on this Query if one was previously
 119        set.
 120
 121        Args:
 122            eq: The exact value that must be matched for a record to be
 123                returned. Pass None if no equality filter should be applied.
 124                Error thrown if min_val or max_val also provided. May also be
 125                a dictionary representing an ORDS query.
 126            min_val: The minimum allowed value, inclusive. Pass None if no
 127                minimum value filter should be applied. Defaults to None. Error
 128                thrown if eq also proivded.
 129            max_val: The maximum allowed value, inclusive. Pass None if no
 130                maximum value filter should be applied. Defaults to None. Error
 131                thrown if eq also proivded.
 132
 133        Returns:
 134            This object for chaining if desired.
 135        """
 136        self._year = self._create_float_param(eq, min_val, max_val)
 137        return self
 138
 139    def filter_srvy(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 140        max_val: OPT_STR = None) -> 'Query':
 141        """Filter on haul survey short name.
 142
 143        Filter on the short name of the survey in which this observation was
 144        made. Pass None if no filter should be applied. Defaults to None. Note
 145        that common values include: NBS (N Bearing Sea), EBS (SE Bearing Sea),
 146        BSS (Bearing Sea Slope), GOA (Gulf of Alaska), and AI (Aleutian
 147        Islands). Overwrites all prior srvy filters if set on this Query.
 148
 149        Args:
 150            eq: The exact value that must be matched for a record to be
 151                returned. Pass None if no equality filter should be applied.
 152                Error thrown if min_val or max_val also provided. May also be
 153                a dictionary representing an ORDS query.
 154            min_val: The minimum allowed value, inclusive. Pass None if no
 155                minimum value filter should be applied. Defaults to None. Error
 156                thrown if eq also proivded.
 157            max_val: The maximum allowed value, inclusive. Pass None if no
 158                maximum value filter should be applied. Defaults to None. Error
 159                thrown if eq also proivded.
 160
 161        Returns:
 162            This object for chaining if desired.
 163        """
 164        self._srvy = self._create_str_param(eq, min_val, max_val)
 165        return self
 166
 167    def filter_survey(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 168        max_val: OPT_STR = None) -> 'Query':
 169        """Filter on survey long name.
 170
 171        Filter on long form description of the survey in which the observation
 172        was made. Overwrites all prior survey filters if set on this Query.
 173
 174        Args:
 175            eq: The exact value that must be matched for a record to be
 176                returned. Pass None if no equality filter should be applied.
 177                Error thrown if min_val or max_val also provided. May also be
 178                a dictionary representing an ORDS query.
 179            min_val: The minimum allowed value, inclusive. Pass None if no
 180                minimum value filter should be applied. Defaults to None. Error
 181                thrown if eq also proivded.
 182            max_val: The maximum allowed value, inclusive. Pass None if no
 183                maximum value filter should be applied. Defaults to None. Error
 184                thrown if eq also proivded.
 185
 186        Returns:
 187            This object for chaining if desired.
 188        """
 189        self._survey = self._create_str_param(eq, min_val, max_val)
 190        return self
 191
 192    def filter_survey_id(self, eq: FLOAT_PARAM = None,
 193        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None) -> 'Query':
 194        """Filter on unique numeric ID for the survey.
 195
 196        Filter on unique numeric ID for the survey, overwritting prior survey ID
 197        filters if set on this Query.
 198
 199        Args:
 200            eq: The exact value that must be matched for a record to be
 201                returned. Pass None if no equality filter should be applied.
 202                Error thrown if min_val or max_val also provided. May also be
 203                a dictionary representing an ORDS query.
 204            min_val: The minimum allowed value, inclusive. Pass None if no
 205                minimum value filter should be applied. Defaults to None. Error
 206                thrown if eq also proivded.
 207            max_val: The maximum allowed value, inclusive. Pass None if no
 208                maximum value filter should be applied. Defaults to None. Error
 209                thrown if eq also proivded.
 210
 211        Returns:
 212            This object for chaining if desired.
 213        """
 214        self._survey_id = self._create_float_param(eq, min_val, max_val)
 215        return self
 216
 217    def filter_cruise(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 218        max_val: OPT_FLOAT = None) -> 'Query':
 219        """Filter on cruise ID.
 220
 221        Filter on an ID uniquely identifying the cruise in which the observation
 222        was made. Overwrites all prior cruise filters on this Query.
 223
 224        Args:
 225            eq: The exact value that must be matched for a record to be
 226                returned. Pass None if no equality filter should be applied.
 227                Error thrown if min_val or max_val also provided. May also be
 228                a dictionary representing an ORDS query.
 229            min_val: The minimum allowed value, inclusive. Pass None if no
 230                minimum value filter should be applied. Defaults to None. Error
 231                thrown if eq also proivded.
 232            max_val: The maximum allowed value, inclusive. Pass None if no
 233                maximum value filter should be applied. Defaults to None. Error
 234                thrown if eq also proivded.
 235
 236        Returns:
 237            This object for chaining if desired.
 238        """
 239        self._cruise = self._create_float_param(eq, min_val, max_val)
 240        return self
 241
 242    def filter_haul(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 243        max_val: OPT_FLOAT = None) -> 'Query':
 244        """Filter on haul identifier.
 245
 246        Filter on an ID uniquely identifying the haul in which this observation
 247        was made. Overwrites all prior haul filters on this Query.
 248
 249        Args:
 250            eq: The exact value that must be matched for a record to be
 251                returned. Pass None if no equality filter should be applied.
 252                Error thrown if min_val or max_val also provided. May also be
 253                a dictionary representing an ORDS query.
 254            min_val: The minimum allowed value, inclusive. Pass None if no
 255                minimum value filter should be applied. Defaults to None. Error
 256                thrown if eq also proivded.
 257            max_val: The maximum allowed value, inclusive. Pass None if no
 258                maximum value filter should be applied. Defaults to None. Error
 259                thrown if eq also proivded.
 260
 261        Returns:
 262            This object for chaining if desired.
 263        """
 264        self._haul = self._create_float_param(eq, min_val, max_val)
 265        return self
 266
 267    def filter_stratum(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 268        max_val: OPT_FLOAT = None) -> 'Query':
 269        """Filter on unique ID for statistical area / survey combination.
 270
 271        Filter on unique ID for statistical area / survey combination,
 272        overwritting all prior stratum filters on Query.
 273
 274        Args:
 275            eq: The exact value that must be matched for a record to be
 276                returned. Pass None if no equality filter should be applied.
 277                Error thrown if min_val or max_val also provided. May also be
 278                a dictionary representing an ORDS query.
 279            min_val: The minimum allowed value, inclusive. Pass None if no
 280                minimum value filter should be applied. Defaults to None. Error
 281                thrown if eq also proivded.
 282            max_val: The maximum allowed value, inclusive. Pass None if no
 283                maximum value filter should be applied. Defaults to None. Error
 284                thrown if eq also proivded.
 285
 286        Returns:
 287            This object for chaining if desired.
 288        """
 289        self._stratum = self._create_float_param(eq, min_val, max_val)
 290        return self
 291
 292    def filter_station(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 293        max_val: OPT_STR = None) -> 'Query':
 294        """Filter on station associated with the survey.
 295
 296        Filter on station associated with the survey, overwritting all prior
 297        station filters on this Query.
 298
 299        Args:
 300            eq: The exact value that must be matched for a record to be
 301                returned. Pass None if no equality filter should be applied.
 302                Error thrown if min_val or max_val also provided. May also be
 303                a dictionary representing an ORDS query.
 304            min_val: The minimum allowed value, inclusive. Pass None if no
 305                minimum value filter should be applied. Defaults to None. Error
 306                thrown if eq also proivded.
 307            max_val: The maximum allowed value, inclusive. Pass None if no
 308                maximum value filter should be applied. Defaults to None. Error
 309                thrown if eq also proivded.
 310
 311        Returns:
 312            This object for chaining if desired.
 313        """
 314        self._station = self._create_str_param(eq, min_val, max_val)
 315        return self
 316
 317    def filter_vessel_name(self, eq: STR_PARAM = None,
 318        min_val: OPT_STR = None, max_val: OPT_STR = None) -> 'Query':
 319        """Filter on unique ID describing the vessel that made this observation.
 320
 321        Filter on unique ID describing the vessel that made this observation,
 322        overwritting all prior vessel name filters on this Query.
 323
 324        Args:
 325            eq: The exact value that must be matched for a record to be
 326                returned. Pass None if no equality filter should be applied.
 327                Error thrown if min_val or max_val also provided. May also be
 328                a dictionary representing an ORDS query.
 329            min_val: The minimum allowed value, inclusive. Pass None if no
 330                minimum value filter should be applied. Defaults to None. Error
 331                thrown if eq also proivded.
 332            max_val: The maximum allowed value, inclusive. Pass None if no
 333                maximum value filter should be applied. Defaults to None. Error
 334                thrown if eq also proivded.
 335
 336        Returns:
 337            This object for chaining if desired.
 338        """
 339        self._vessel_name = self._create_str_param(eq, min_val, max_val)
 340        return self
 341
 342    def filter_vessel_id(self, eq: FLOAT_PARAM = None,
 343        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None) -> 'Query':
 344        """Filter on name of the vessel at the time the observation was made.
 345
 346        Filter on name of the vessel at the time the observation was made,
 347        overwritting all prior vessel ID filters on this Query.
 348
 349        Args:
 350            eq: The exact value that must be matched for a record to be
 351                returned. Pass None if no equality filter should be applied.
 352                Error thrown if min_val or max_val also provided. May also be
 353                a dictionary representing an ORDS query.
 354            min_val: The minimum allowed value, inclusive. Pass None if no
 355                minimum value filter should be applied. Defaults to None. Error
 356                thrown if eq also proivded.
 357            max_val: The maximum allowed value, inclusive. Pass None if no
 358                maximum value filter should be applied. Defaults to None. Error
 359                thrown if eq also proivded.
 360
 361        Returns:
 362            This object for chaining if desired.
 363        """
 364        self._vessel_id = self._create_float_param(eq, min_val, max_val)
 365        return self
 366
 367    def filter_date_time(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 368        max_val: OPT_STR = None) -> 'Query':
 369        """Filter on the date and time of the haul.
 370
 371        Filter on the date and time of the haul as an ISO 8601 string. If given
 372        an ISO 8601 string, will afscgap.convert from ISO 8601 to the API
 373        datetime string format. Similarly, if given a dictionary, all values
 374        matching an ISO 8601 string will be afscgap.converted to the API
 375        datetime string format. Overwrites all prior date time filters on
 376        this Query.
 377
 378        Args:
 379            eq: The exact value that must be matched for a record to be
 380                returned. Pass None if no equality filter should be applied.
 381                Error thrown if min_val or max_val also provided. May also be
 382                a dictionary representing an ORDS query.
 383            min_val: The minimum allowed value, inclusive. Pass None if no
 384                minimum value filter should be applied. Defaults to None. Error
 385                thrown if eq also proivded.
 386            max_val: The maximum allowed value, inclusive. Pass None if no
 387                maximum value filter should be applied. Defaults to None. Error
 388                thrown if eq also proivded.
 389
 390        Returns:
 391            This object for chaining if desired.
 392        """
 393        self._date_time = self._create_str_param(eq, min_val, max_val)
 394        return self
 395
 396    def filter_latitude(self, eq: FLOAT_PARAM = None,
 397        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 398        units: str = 'dd') -> 'Query':
 399        """Filter on latitude in decimal degrees associated with the haul.
 400
 401        Filter on latitude in decimal degrees associated with the haul,
 402        overwritting all prior latitude filters on this Query.
 403
 404        Args:
 405            eq: The exact value that must be matched for a record to be
 406                returned. Pass None if no equality filter should be applied.
 407                Error thrown if min_val or max_val also provided. May also be
 408                a dictionary representing an ORDS query.
 409            min_val: The minimum allowed value, inclusive. Pass None if no
 410                minimum value filter should be applied. Defaults to None. Error
 411                thrown if eq also proivded.
 412            max_val: The maximum allowed value, inclusive. Pass None if no
 413                maximum value filter should be applied. Defaults to None. Error
 414                thrown if eq also proivded.
 415            units: The units in which the filter values are provided. Currently
 416                only dd supported. Ignored if given eq value containing ORDS
 417                query.
 418
 419        Returns:
 420            This object for chaining if desired.
 421        """
 422        self._latitude_dd = self._create_float_param(
 423            afscgap.convert.unconvert_degrees(eq, units),
 424            afscgap.convert.unconvert_degrees(min_val, units),
 425            afscgap.convert.unconvert_degrees(max_val, units)
 426        )
 427        return self
 428
 429    def filter_longitude(self, eq: FLOAT_PARAM = None,
 430        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 431        units: str = 'dd') -> 'Query':
 432        """Filter on longitude in decimal degrees associated with the haul.
 433
 434        Filter on longitude in decimal degrees associated with the haul,
 435        overwritting all prior longitude filters on this Query.
 436
 437        Args:
 438            eq: The exact value that must be matched for a record to be
 439                returned. Pass None if no equality filter should be applied.
 440                Error thrown if min_val or max_val also provided. May also be
 441                a dictionary representing an ORDS query.
 442            min_val: The minimum allowed value, inclusive. Pass None if no
 443                minimum value filter should be applied. Defaults to None. Error
 444                thrown if eq also proivded.
 445            max_val: The maximum allowed value, inclusive. Pass None if no
 446                maximum value filter should be applied. Defaults to None. Error
 447                thrown if eq also proivded.
 448            units: The units in which the filter values are provided. Currently
 449                only dd supported.
 450
 451        Returns:
 452            This object for chaining if desired.
 453        """
 454        self._longitude_dd = self._create_float_param(
 455            afscgap.convert.unconvert_degrees(eq, units),
 456            afscgap.convert.unconvert_degrees(min_val, units),
 457            afscgap.convert.unconvert_degrees(max_val, units)
 458        )
 459        return self
 460
 461    def filter_species_code(self, eq: FLOAT_PARAM = None,
 462        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None) -> 'Query':
 463        """Filter on unique ID associated with the species observed.
 464
 465        Filter on unique ID associated with the species observed, overwritting
 466        all prior species code filters on this Query.
 467
 468        Args:
 469            eq: The exact value that must be matched for a record to be
 470                returned. Pass None if no equality filter should be applied.
 471                Error thrown if min_val or max_val also provided. May also be
 472                a dictionary representing an ORDS query.
 473            min_val: The minimum allowed value, inclusive. Pass None if no
 474                minimum value filter should be applied. Defaults to None. Error
 475                thrown if eq also proivded.
 476            max_val: The maximum allowed value, inclusive. Pass None if no
 477                maximum value filter should be applied. Defaults to None. Error
 478                thrown if eq also proivded.
 479
 480        Returns:
 481            This object for chaining if desired.
 482        """
 483        self._species_code = self._create_float_param(eq, min_val, max_val)
 484        return self
 485
 486    def filter_common_name(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 487        max_val: OPT_STR = None) -> 'Query':
 488        """Filter on the "common name" associated with the species observed.
 489
 490        Filter on the "common name" associated with the species observed,
 491        overwritting all prior common name filters on this Query.
 492
 493        Args:
 494            eq: The exact value that must be matched for a record to be
 495                returned. Pass None if no equality filter should be applied.
 496                Error thrown if min_val or max_val also provided. May also be
 497                a dictionary representing an ORDS query.
 498            min_val: The minimum allowed value, inclusive. Pass None if no
 499                minimum value filter should be applied. Defaults to None. Error
 500                thrown if eq also proivded.
 501            max_val: The maximum allowed value, inclusive. Pass None if no
 502                maximum value filter should be applied. Defaults to None. Error
 503                thrown if eq also proivded.
 504
 505        Returns:
 506            This object for chaining if desired.
 507        """
 508        self._common_name = self._create_str_param(eq, min_val, max_val)
 509        return self
 510
 511    def filter_scientific_name(self, eq: STR_PARAM = None,
 512        min_val: OPT_STR = None, max_val: OPT_STR = None) -> 'Query':
 513        """Filter on the "scientific name" associated with the species observed.
 514
 515        Filter on the "scientific name" associated with the species observed,
 516        overwritting all prior scientific name filters on this Query.
 517
 518        Args:
 519            eq: The exact value that must be matched for a record to be
 520                returned. Pass None if no equality filter should be applied.
 521                Error thrown if min_val or max_val also provided. May also be
 522                a dictionary representing an ORDS query.
 523            min_val: The minimum allowed value, inclusive. Pass None if no
 524                minimum value filter should be applied. Defaults to None. Error
 525                thrown if eq also proivded.
 526            max_val: The maximum allowed value, inclusive. Pass None if no
 527                maximum value filter should be applied. Defaults to None. Error
 528                thrown if eq also proivded.
 529
 530        Returns:
 531            This object for chaining if desired.
 532        """
 533        self._scientific_name = self._create_str_param(eq, min_val, max_val)
 534        return self
 535
 536    def filter_taxon_confidence(self, eq: STR_PARAM = None,
 537        min_val: OPT_STR = None, max_val: OPT_STR = None) -> 'Query':
 538        """Filter on confidence flag regarding ability to identify species.
 539
 540        Filter on confidence flag regarding ability to identify species,
 541        overwritting all taxon confidence filters on this Query.
 542
 543        Args:
 544            eq: The exact value that must be matched for a record to be
 545                returned. Pass None if no equality filter should be applied.
 546                Error thrown if min_val or max_val also provided. May also be
 547                a dictionary representing an ORDS query.
 548            min_val: The minimum allowed value, inclusive. Pass None if no
 549                minimum value filter should be applied. Defaults to None. Error
 550                thrown if eq also proivded.
 551            max_val: The maximum allowed value, inclusive. Pass None if no
 552                maximum value filter should be applied. Defaults to None. Error
 553                thrown if eq also proivded.
 554
 555        Returns:
 556            This object for chaining if desired.
 557        """
 558        self._taxon_confidence = self._create_str_param(eq, min_val, max_val)
 559        return self
 560
 561    def filter_cpue_weight(self, eq: FLOAT_PARAM = None,
 562        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 563        units: str = 'kg/ha') -> 'Query':
 564        """Filter on catch per unit effort.
 565
 566        Filter on catch per unit effort as weight divided by net area if
 567        available. Overwrites all prior CPUE weight filters applied to this
 568        Query.
 569
 570        Args:
 571            eq: The exact value that must be matched for a record to be
 572                returned. Pass None if no equality filter should be applied.
 573                Error thrown if min_val or max_val also provided. May also be
 574                a dictionary representing an ORDS query.
 575            min_val: The minimum allowed value, inclusive. Pass None if no
 576                minimum value filter should be applied. Defaults to None. Error
 577                thrown if eq also proivded.
 578            max_val: The maximum allowed value, inclusive. Pass None if no
 579                maximum value filter should be applied. Defaults to None. Error
 580                thrown if eq also proivded.
 581            units: The units for the catch per unit effort provided. Options:
 582                kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha. Ignored if given
 583                eq value containing ORDS query.
 584
 585        Returns:
 586            This object for chaining if desired.
 587        """
 588        param = self._create_float_param(eq, min_val, max_val)
 589
 590        self._cpue_kgha = None
 591        self._cpue_kgkm2 = None
 592        self._cpue_kg1000km2 = None
 593
 594        if units == 'kg/ha':
 595            self._cpue_kgha = param
 596        elif units == 'kg/km2':
 597            self._cpue_kgkm2 = param
 598        elif units == 'kg1000/km2':
 599            self._cpue_kg1000km2 = param
 600        else:
 601            raise RuntimeError('Unrecognized units ' + units)
 602
 603        return self
 604
 605    def filter_cpue_count(self, eq: FLOAT_PARAM = None,
 606        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 607        units: str = 'count/ha') -> 'Query':
 608        """Filter catch per unit effort as count over area in hectares.
 609
 610        Filter on catch number divided by net sweep area if available (count /
 611        hectares). Overwrites all prior CPUE count filters applied to this
 612        Query.
 613
 614        Args:
 615            eq: The exact value that must be matched for a record to be
 616                returned. Pass None if no equality filter should be applied.
 617                Error thrown if min_val or max_val also provided. May also be
 618                a dictionary representing an ORDS query.
 619            min_val: The minimum allowed value, inclusive. Pass None if no
 620                minimum value filter should be applied. Defaults to None. Error
 621                thrown if eq also proivded.
 622            max_val: The maximum allowed value, inclusive. Pass None if no
 623                maximum value filter should be applied. Defaults to None. Error
 624                thrown if eq also proivded.
 625            units: The units for the given catch per unit effort. Options:
 626                count/ha, count/km2, and count1000/km2. Defaults to count/ha.
 627                Ignored if given eq value containing ORDS query.
 628
 629        Returns:
 630            This object for chaining if desired.
 631        """
 632        param = self._create_float_param(eq, min_val, max_val)
 633
 634        self._cpue_noha = None
 635        self._cpue_nokm2 = None
 636        self._cpue_no1000km2 = None
 637
 638        if units == 'count/ha':
 639            self._cpue_noha = param
 640        elif units == 'count/km2':
 641            self._cpue_nokm2 = param
 642        elif units == 'count1000/km2':
 643            self._cpue_no1000km2 = param
 644        else:
 645            raise RuntimeError('Unrecognized units ' + units)
 646
 647        return self
 648
 649    def filter_weight(self, eq: FLOAT_PARAM = None,
 650        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 651        units: str = 'kg') -> 'Query':
 652        """Filter on taxon weight (kg) if available.
 653
 654        Filter on taxon weight (kg) if available, overwrites all prior weight
 655        filters applied to this Query.
 656
 657        Args:
 658            eq: The exact value that must be matched for a record to be
 659                returned. Pass None if no equality filter should be applied.
 660                Error thrown if min_val or max_val also provided. May also be
 661                a dictionary representing an ORDS query.
 662            min_val: The minimum allowed value, inclusive. Pass None if no
 663                minimum value filter should be applied. Defaults to None. Error
 664                thrown if eq also proivded.
 665            max_val: The maximum allowed value, inclusive. Pass None if no
 666                maximum value filter should be applied. Defaults to None. Error
 667                thrown if eq also proivded.
 668            units: The units in which the weight are given. Options are
 669                g, kg for grams and kilograms respectively. Deafults to kg.
 670                Ignored if given eq value containing ORDS query.
 671
 672        Returns:
 673            This object for chaining if desired.
 674        """
 675        self._weight_kg = self._create_float_param(
 676            afscgap.convert.unconvert_weight(eq, units),
 677            afscgap.convert.unconvert_weight(min_val, units),
 678            afscgap.convert.unconvert_weight(max_val, units)
 679        )
 680        return self
 681
 682    def filter_count(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 683        max_val: OPT_FLOAT = None) -> 'Query':
 684        """Filter on total number of organism individuals in haul.
 685
 686        Filter on total number of organism individuals in haul, overwrites all
 687        prior count filters applied to this Query.
 688
 689        Args:
 690            eq: The exact value that must be matched for a record to be
 691                returned. Pass None if no equality filter should be applied.
 692                Error thrown if min_val or max_val also provided. May also be
 693                a dictionary representing an ORDS query.
 694            min_val: The minimum allowed value, inclusive. Pass None if no
 695                minimum value filter should be applied. Defaults to None. Error
 696                thrown if eq also proivded.
 697            max_val: The maximum allowed value, inclusive. Pass None if no
 698                maximum value filter should be applied. Defaults to None. Error
 699                thrown if eq also proivded. Ignored if given eq value containing
 700                ORDS query.
 701
 702        Returns:
 703            This object for chaining if desired.
 704        """
 705        self._count = self._create_float_param(eq, min_val, max_val)
 706        return self
 707
 708    def filter_bottom_temperature(self, eq: FLOAT_PARAM = None,
 709        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 710        units: str = 'c') -> 'Query':
 711        """Filter on bottom temperature.
 712
 713        Filter on bottom temperature associated with observation if available in
 714        the units given. Overwrites all prior bottom temperature filters applied
 715        to this Query.
 716
 717        Args:
 718            eq: The exact value that must be matched for a record to be
 719                returned. Pass None if no equality filter should be applied.
 720                Error thrown if min_val or max_val also provided. May also be
 721                a dictionary representing an ORDS query.
 722            min_val: The minimum allowed value, inclusive. Pass None if no
 723                minimum value filter should be applied. Defaults to None. Error
 724                thrown if eq also proivded.
 725            max_val: The maximum allowed value, inclusive. Pass None if no
 726                maximum value filter should be applied. Defaults to None. Error
 727                thrown if eq also proivded.
 728            units: The units in which the temperature filter values are given.
 729                Options: c or f for Celcius and Fahrenheit respectively.
 730                Defaults to c. Ignored if given eq value containing ORDS query.
 731
 732        Returns:
 733            This object for chaining if desired.
 734        """
 735        self._bottom_temperature_c = self._create_float_param(
 736            afscgap.convert.unconvert_temperature(eq, units),
 737            afscgap.convert.unconvert_temperature(min_val, units),
 738            afscgap.convert.unconvert_temperature(max_val, units)
 739        )
 740        return self
 741
 742    def filter_surface_temperature(self, eq: FLOAT_PARAM = None,
 743        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 744        units: str = 'c') -> 'Query':
 745        """Filter on surface temperature.
 746
 747        Filter on surface temperature associated with observation if available
 748        in the units given. Overwrites all prior bottom temperature filters
 749        applied to this Query.
 750
 751        Args:
 752            eq: The exact value that must be matched for a record to be
 753                returned. Pass None if no equality filter should be applied.
 754                Error thrown if min_val or max_val also provided. May also be
 755                a dictionary representing an ORDS query.
 756            min_val: The minimum allowed value, inclusive. Pass None if no
 757                minimum value filter should be applied. Defaults to None. Error
 758                thrown if eq also proivded.
 759            max_val: The maximum allowed value, inclusive. Pass None if no
 760                maximum value filter should be applied. Defaults to None. Error
 761                thrown if eq also proivded.
 762            units: The units in which the temperature filter values are given.
 763                Options: c or f for Celcius and Fahrenheit respectively.
 764                Defaults to c. Ignored if given eq value containing ORDS query.
 765
 766        Returns:
 767            This object for chaining if desired.
 768        """
 769        self._surface_temperature_c = self._create_float_param(
 770            afscgap.convert.unconvert_temperature(eq, units),
 771            afscgap.convert.unconvert_temperature(min_val, units),
 772            afscgap.convert.unconvert_temperature(max_val, units)
 773        )
 774        return self
 775
 776    def filter_depth(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 777        max_val: OPT_FLOAT = None, units: str = 'm') -> 'Query':
 778        """Filter on depth of the bottom in meters.
 779
 780        Filter on depth of the bottom in meters, overwrites all prior depth
 781        filters applied to this Query.
 782
 783        Args:
 784            eq: The exact value that must be matched for a record to be
 785                returned. Pass None if no equality filter should be applied.
 786                Error thrown if min_val or max_val also provided. May also be
 787                a dictionary representing an ORDS query.
 788            min_val: The minimum allowed value, inclusive. Pass None if no
 789                minimum value filter should be applied. Defaults to None. Error
 790                thrown if eq also proivded.
 791            max_val: The maximum allowed value, inclusive. Pass None if no
 792                maximum value filter should be applied. Defaults to None. Error
 793                thrown if eq also proivded.
 794            units: The units in which the distance are given. Options:
 795                m or km for meters and kilometers respectively. Defaults to m.
 796                Ignored if given eq value containing ORDS query.
 797
 798        Returns:
 799            This object for chaining if desired.
 800        """
 801        self._depth_m = self._create_float_param(
 802            afscgap.convert.unconvert_distance(eq, units),
 803            afscgap.convert.unconvert_distance(min_val, units),
 804            afscgap.convert.unconvert_distance(max_val, units)
 805        )
 806        return self
 807
 808    def filter_distance_fished(self, eq: FLOAT_PARAM = None,
 809        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 810        units: str = 'm') -> 'Query':
 811        """Filter on distance of the net fished.
 812
 813        Filter on distance of the net fished, overwritting prior distance fished
 814        filters applied to this Query.
 815
 816        Args:
 817            eq: The exact value that must be matched for a record to be
 818                returned. Pass None if no equality filter should be applied.
 819                Error thrown if min_val or max_val also provided. May also be
 820                a dictionary representing an ORDS query.
 821            min_val: The minimum allowed value, inclusive. Pass None if no
 822                minimum value filter should be applied. Defaults to None. Error
 823                thrown if eq also proivded.
 824            max_val: The maximum allowed value, inclusive. Pass None if no
 825                maximum value filter should be applied. Defaults to None. Error
 826                thrown if eq also proivded.
 827            units: The units in which the distance values are given. Options:
 828                m or km for meters and kilometers respectively. Defaults to m.
 829                Ignored if given eq value containing ORDS query.
 830
 831        Returns:
 832            This object for chaining if desired.
 833        """
 834        def convert_to_km(target, units):
 835            in_meters = afscgap.convert.unconvert_distance(target, units)
 836            return afscgap.convert.convert_distance(in_meters, 'km')
 837
 838        self._distance_fished_km = self._create_float_param(
 839            convert_to_km(eq, units),
 840            convert_to_km(min_val, units),
 841            convert_to_km(max_val, units)
 842        )
 843        return self
 844
 845    def filter_net_width(self, eq: FLOAT_PARAM = None,
 846        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 847        units: str = 'm') -> 'Query':
 848        """Filter on distance of the net fished.
 849
 850        Filter on distance of the net fished, overwritting prior net width
 851        filters applied to this Query.
 852
 853        Args:
 854            eq: The exact value that must be matched for a record to be
 855                returned. Pass None if no equality filter should be applied.
 856                Error thrown if min_val or max_val also provided. May also be
 857                a dictionary representing an ORDS query.
 858            min_val: The minimum allowed value, inclusive. Pass None if no
 859                minimum value filter should be applied. Defaults to None. Error
 860                thrown if eq also proivded.
 861            max_val: The maximum allowed value, inclusive. Pass None if no
 862                maximum value filter should be applied. Defaults to None. Error
 863                thrown if eq also proivded.
 864            units: The units in which the distance should be returned. Options:
 865                m or km for meters and kilometers respectively. Defaults to m.
 866
 867        Returns:
 868            This object for chaining if desired.
 869        """
 870        self._net_width_m = self._create_float_param(
 871            afscgap.convert.unconvert_distance(eq, units),
 872            afscgap.convert.unconvert_distance(min_val, units),
 873            afscgap.convert.unconvert_distance(max_val, units)
 874        )
 875        return self
 876
 877    def filter_net_height(self, eq: FLOAT_PARAM = None,
 878        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 879        units: str = 'm') -> 'Query':
 880        """Filter on height of the net fished.
 881
 882        Filter on height of the net fished, overwritting prior net height
 883        filters applied to this Query.
 884
 885        Args:
 886            eq: The exact value that must be matched for a record to be
 887                returned. Pass None if no equality filter should be applied.
 888                Error thrown if min_val or max_val also provided. May also be
 889                a dictionary representing an ORDS query.
 890            min_val: The minimum allowed value, inclusive. Pass None if no
 891                minimum value filter should be applied. Defaults to None. Error
 892                thrown if eq also proivded.
 893            max_val: The maximum allowed value, inclusive. Pass None if no
 894                maximum value filter should be applied. Defaults to None. Error
 895                thrown if eq also proivded.
 896            units: The units in which the distance should be returned. Options:
 897                m or km for meters and kilometers respectively. Defaults to m.
 898
 899        Returns:
 900            This object for chaining if desired.
 901        """
 902        self._net_height_m = self._create_float_param(
 903            afscgap.convert.unconvert_distance(eq, units),
 904            afscgap.convert.unconvert_distance(min_val, units),
 905            afscgap.convert.unconvert_distance(max_val, units)
 906        )
 907        return self
 908
 909    def filter_area_swept(self, eq: FLOAT_PARAM = None,
 910        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 911        units: str = 'm') -> 'Query':
 912        """Filter on area covered by the net while fishing.
 913
 914        Filter on area covered by the net while fishing, overwritting prior
 915        area swept filters applied to this Query.
 916
 917        Args:
 918            eq: The exact value that must be matched for a record to be
 919                returned. Pass None if no equality filter should be applied.
 920                Error thrown if min_val or max_val also provided. May also be
 921                a dictionary representing an ORDS query.
 922            min_val: The minimum allowed value, inclusive. Pass None if no
 923                minimum value filter should be applied. Defaults to None. Error
 924                thrown if eq also proivded.
 925            max_val: The maximum allowed value, inclusive. Pass None if no
 926                maximum value filter should be applied. Defaults to None. Error
 927                thrown if eq also proivded.
 928            units: The units in which the area should be returned. Options:
 929                ha, m2, km2. Defaults to ha.
 930
 931        Returns:
 932            This object for chaining if desired.
 933        """
 934        self._area_swept_ha = self._create_float_param(
 935            afscgap.convert.unconvert_area(eq, units),
 936            afscgap.convert.unconvert_area(min_val, units),
 937            afscgap.convert.unconvert_area(max_val, units)
 938        )
 939        return self
 940
 941    def filter_duration(self, eq: FLOAT_PARAM = None,
 942        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 943        units: str = 'hr') -> 'Query':
 944        """Filter on duration of the haul.
 945
 946        Filter on duration of the haul, ovewritting all prior duration filters
 947        applied to this Query.
 948
 949        Args:
 950            eq: The exact value that must be matched for a record to be
 951                returned. Pass None if no equality filter should be applied.
 952                Error thrown if min_val or max_val also provided. May also be
 953                a dictionary representing an ORDS query.
 954            min_val: The minimum allowed value, inclusive. Pass None if no
 955                minimum value filter should be applied. Defaults to None. Error
 956                thrown if eq also proivded.
 957            max_val: The maximum allowed value, inclusive. Pass None if no
 958                maximum value filter should be applied. Defaults to None. Error
 959                thrown if eq also proivded.
 960            units: The units in which the duration should be returned. Options:
 961                day, hr, min. Defaults to hr.
 962
 963        Returns:
 964            This object for chaining if desired.
 965        """
 966        self._duration_hr = self._create_float_param(
 967            afscgap.convert.unconvert_time(eq, units),
 968            afscgap.convert.unconvert_time(min_val, units),
 969            afscgap.convert.unconvert_time(max_val, units)
 970        )
 971        return self
 972
 973    def filter_tsn(self, eq: INT_PARAM = None, min_val: OPT_INT = None,
 974        max_val: OPT_INT = None) -> 'Query':
 975        """Filter on taxonomic information system species code.
 976
 977        Filter on taxonomic information system species code, overwritting all
 978        prior TSN filters applied to this Query.
 979
 980        Args:
 981            eq: The exact value that must be matched for a record to be
 982                returned. Pass None if no equality filter should be applied.
 983                Error thrown if min_val or max_val also provided. May also be
 984                a dictionary representing an ORDS query.
 985            min_val: The minimum allowed value, inclusive. Pass None if no
 986                minimum value filter should be applied. Defaults to None. Error
 987                thrown if eq also proivded.
 988            max_val: The maximum allowed value, inclusive. Pass None if no
 989                maximum value filter should be applied. Defaults to None. Error
 990                thrown if eq also proivded.
 991
 992        Returns:
 993            This object for chaining if desired.
 994        """
 995        self._tsn = self._create_int_param(eq, min_val, max_val)
 996        return self
 997
 998    def filter_ak_survey_id(self, eq: INT_PARAM = None, min_val: OPT_INT = None,
 999        max_val: OPT_INT = None) -> 'Query':
1000        """Filter on AK identifier for the survey.
1001
1002        Filter on AK identifier for the survey, overwritting all prior AK ID
1003        filters applied to this Query.
1004
1005        Args:
1006            eq: The exact value that must be matched for a record to be
1007                returned. Pass None if no equality filter should be applied.
1008                Error thrown if min_val or max_val also provided. May also be
1009                a dictionary representing an ORDS query.
1010            min_val: The minimum allowed value, inclusive. Pass None if no
1011                minimum value filter should be applied. Defaults to None. Error
1012                thrown if eq also proivded.
1013            max_val: The maximum allowed value, inclusive. Pass None if no
1014                maximum value filter should be applied. Defaults to None. Error
1015                thrown if eq also proivded.
1016
1017        Returns:
1018            This object for chaining if desired.
1019        """
1020        self._ak_survey_id = self._create_int_param(eq, min_val, max_val)
1021        return self
1022
1023    def set_limit(self, limit: OPT_INT) -> 'Query':
1024        """Set the max number of results.
1025
1026        Set the max number of results, overwritting prior limit settings on this
1027        Query.
1028
1029        Args:
1030            limit: The maximum number of results to retrieve per HTTP request.
1031                If None or not provided, will use API's default.
1032
1033        Returns:
1034            This object for chaining if desired.
1035        """
1036        self._limit = limit
1037        return self
1038
1039    def set_start_offset(self, start_offset: OPT_INT) -> 'Query':
1040        """Indicate how many results to skip.
1041
1042        Indicate how many results to skip, overwritting prior offset settings on
1043        this Query.
1044
1045        Args:
1046            start_offset: The number of initial results to skip in retrieving
1047                results. If None or not provided, none will be skipped.
1048
1049        Returns:
1050            This object for chaining if desired.
1051        """
1052        self._start_offset = start_offset
1053        return self
1054
1055    def set_filter_incomplete(self, filter_incomplete: bool) -> 'Query':
1056        """Indicate if incomplete records should be filtered out.
1057
1058        Indicate if incomplete records should be filtered out, overwritting
1059        prior incomplete filter settings on this Query.
1060
1061        Args:
1062            filter_incomplete: Flag indicating if "incomplete" records should be
1063                filtered. If true, "incomplete" records are silently filtered
1064                from the results, putting them in the invalid records queue. If
1065                false, they are included and their is_complete() will return
1066                false. Defaults to false.
1067
1068        Returns:
1069            This object for chaining if desired.
1070        """
1071        self._filter_incomplete = filter_incomplete
1072        return self
1073
1074    def set_presence_only(self, presence_only: bool) -> 'Query':
1075        """Indicate if zero catch inference should be enabled.
1076
1077        Indicate if zero catch inference should be enabled, overwritting prior
1078        abscence / zero catch data settings on this Query.
1079
1080        Args:
1081            presence_only: Flag indicating if abscence / zero catch data should
1082                be inferred. If false, will run abscence data inference. If
1083                true, will return presence only data as returned by the NOAA API
1084                service. Defaults to true.
1085
1086        Returns:
1087            This object for chaining if desired.
1088        """
1089        self._presence_only = presence_only
1090        return self
1091
1092    def set_suppress_large_warning(self, supress: bool) -> 'Query':
1093        """Indicate if the large results warning should be supressed.
1094
1095        Indicate if the large results warning should be supressed, overwritting
1096        prior large results warning supressions settings on this Query.
1097
1098        Args:
1099            suppress_large_warning: Indicate if the library should warn when an
1100                operation may consume a large amount of memory. If true, the
1101                warning will not be emitted. Defaults to true.
1102
1103        Returns:
1104            This object for chaining if desired.
1105        """
1106        self._suppress_large_warning = supress
1107        return self
1108
1109    def set_warn_function(self, warn_function: WARN_FUNCTION) -> 'Query':
1110        """Indicate how warnings should be emitted.
1111
1112        Indicate how warnings should be emitted, overwritting the prior warning
1113        function settings on this Query.
1114
1115        Args:
1116            warn_function: Function to call with a message describing warnings
1117                encountered. If None, will use warnings.warn. Defaults to None.
1118
1119        Returns:
1120            This object for chaining if desired.
1121        """
1122        self._warn_function = warn_function
1123        return self
1124
1125    def set_hauls_prefetch(self, hauls_prefetch: OPT_HAUL_LIST) -> 'Query':
1126        """Indicate if hauls' data were prefetched.
1127
1128        Indicate if hauls' data were prefetched, overwritting prior prefetch
1129        settings on this Query.
1130
1131        Args:
1132            hauls_prefetch: If using presence_only=True, this is ignored.
1133                Otherwise, if None, will instruct the library to download hauls
1134                metadata. If not None, will use this as the hauls list for zero
1135                catch record inference.
1136
1137        Returns:
1138            This object for chaining if desired.
1139        """
1140        self._hauls_prefetch = hauls_prefetch
1141        return self
1142
1143    def execute(self) -> afscgap.cursor.Cursor:
1144        """Execute the query built up in this object.
1145
1146        Execute the query built up in this object using its current state. Note
1147        that later changes to this builder will not impact prior returned
1148        Cursors from execute.
1149
1150        Returns:
1151            Cursor to manage HTTP requests and query results.
1152        """
1153        all_dict_raw = {
1154            'year': self._year,
1155            'srvy': self._srvy,
1156            'survey': self._survey,
1157            'survey_id': self._survey_id,
1158            'cruise': self._cruise,
1159            'haul': self._haul,
1160            'stratum': self._stratum,
1161            'station': self._station,
1162            'vessel_name': self._vessel_name,
1163            'vessel_id': self._vessel_id,
1164            'date_time': self._date_time,
1165            'latitude_dd': self._latitude_dd,
1166            'longitude_dd': self._longitude_dd,
1167            'species_code': self._species_code,
1168            'common_name': self._common_name,
1169            'scientific_name': self._scientific_name,
1170            'taxon_confidence': self._taxon_confidence,
1171            'cpue_kgha': self._cpue_kgha,
1172            'cpue_kgkm2': self._cpue_kgkm2,
1173            'cpue_kg1000km2': self._cpue_kg1000km2,
1174            'cpue_noha': self._cpue_noha,
1175            'cpue_nokm2': self._cpue_nokm2,
1176            'cpue_no1000km2': self._cpue_no1000km2,
1177            'weight_kg': self._weight_kg,
1178            'count': self._count,
1179            'bottom_temperature_c': self._bottom_temperature_c,
1180            'surface_temperature_c': self._surface_temperature_c,
1181            'depth_m': self._depth_m,
1182            'distance_fished_km': self._distance_fished_km,
1183            'net_width_m': self._net_width_m,
1184            'net_height_m': self._net_height_m,
1185            'area_swept_ha': self._area_swept_ha,
1186            'duration_hr': self._duration_hr,
1187            'tsn': self._tsn,
1188            'ak_survey_id': self._ak_survey_id
1189        }
1190
1191        api_cursor = afscgap.client.build_api_cursor(
1192            all_dict_raw,
1193            limit=self._limit,
1194            start_offset=self._start_offset,
1195            filter_incomplete=self._filter_incomplete,
1196            requestor=self._requestor,
1197            base_url=self._base_url
1198        )
1199
1200        if self._presence_only:
1201            return api_cursor
1202
1203        decorated_cursor = afscgap.inference.build_inference_cursor(
1204            all_dict_raw,
1205            api_cursor,
1206            requestor=self._requestor,
1207            hauls_url=self._hauls_url,
1208            hauls_prefetch=self._hauls_prefetch
1209        )
1210
1211        if not self._suppress_large_warning:
1212            warn_function = self._warn_function
1213            if not warn_function:
1214                warn_function = lambda x: warnings.warn(x)
1215
1216            warn_function(LARGE_WARNING)
1217
1218        return decorated_cursor
1219
1220    def _create_str_param(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
1221        max_val: OPT_STR = None) -> STR_PARAM:
1222        """Create a new string parameter.
1223
1224        Args:
1225            eq: The exact value that must be matched for a record to be
1226                returned. Pass None if no equality filter should be applied.
1227                Error thrown if min_val or max_val also provided. May also be
1228                a dictionary representing an ORDS query.
1229            min_val: The minimum allowed value, inclusive. Pass None if no
1230                minimum value filter should be applied. Defaults to None. Error
1231                thrown if eq also proivded.
1232            max_val: The maximum allowed value, inclusive. Pass None if no
1233                maximum value filter should be applied. Defaults to None. Error
1234                thrown if eq also proivded.
1235
1236        """
1237        return self._create_param(eq, min_val, max_val)  # type: ignore
1238
1239    def _create_float_param(self, eq: FLOAT_PARAM = None,
1240        min_val: FLOAT_PARAM = None,
1241        max_val: FLOAT_PARAM = None) -> FLOAT_PARAM:
1242        """Create a new float parameter.
1243
1244        Args:
1245            eq: The exact value that must be matched for a record to be
1246                returned. Pass None if no equality filter should be applied.
1247                Error thrown if min_val or max_val also provided. May also be
1248                a dictionary representing an ORDS query.
1249            min_val: The minimum allowed value, inclusive. Pass None if no
1250                minimum value filter should be applied. Defaults to None. Error
1251                thrown if eq also proivded.
1252            max_val: The maximum allowed value, inclusive. Pass None if no
1253                maximum value filter should be applied. Defaults to None. Error
1254                thrown if eq also proivded.
1255        """
1256        return self._create_param(eq, min_val, max_val)  # type: ignore
1257
1258    def _create_int_param(self, eq: INT_PARAM = None, min_val: OPT_INT = None,
1259        max_val: OPT_INT = None) -> INT_PARAM:
1260        """Create a new int parameter.
1261
1262        Args:
1263            eq: The exact value that must be matched for a record to be
1264                returned. Pass None if no equality filter should be applied.
1265                Error thrown if min_val or max_val also provided. May also be
1266                a dictionary representing an ORDS query.
1267            min_val: The minimum allowed value, inclusive. Pass None if no
1268                minimum value filter should be applied. Defaults to None. Error
1269                thrown if eq also proivded.
1270            max_val: The maximum allowed value, inclusive. Pass None if no
1271                maximum value filter should be applied. Defaults to None. Error
1272                thrown if eq also proivded.
1273        Returns:
1274            Compatible param representation.
1275        """
1276        return self._create_param(eq, min_val, max_val)  # type: ignore
1277
1278    def _create_param(self, eq=None, min_val=None, max_val=None):
1279        """Create a new parameter.
1280
1281        Args:
1282            eq: The exact value that must be matched for a record to be
1283                returned. Pass None if no equality filter should be applied.
1284                Error thrown if min_val or max_val also provided. May also be
1285                a dictionary representing an ORDS query.
1286            min_val: The minimum allowed value, inclusive. Pass None if no
1287                minimum value filter should be applied. Defaults to None. Error
1288                thrown if eq also proivded.
1289            max_val: The maximum allowed value, inclusive. Pass None if no
1290                maximum value filter should be applied. Defaults to None. Error
1291                thrown if eq also proivded.
1292        Returns:
1293            Compatible param representation.
1294        """
1295        eq_given = eq is not None
1296        min_val_given = min_val is not None
1297        max_val_given = max_val is not None
1298
1299        if eq_given and (min_val_given and max_val_given):
1300            raise RuntimeError('Cannot query with both eq and min/max val.')
1301
1302        if eq_given:
1303            return eq
1304        elif min_val_given or max_val_given:
1305            return [min_val, max_val]
1306        else:
1307            return None
WARN_FUNCTION = typing.Optional[typing.Callable[[str], NoneType]]
LARGE_WARNING = 'Your query may return a very large amount of records. Be sure to interact with results in a memory efficient way.'
class Query:
  43class Query:
  44    """Entrypoint for the AFSC GAP Python library.
  45
  46    Facade for executing queries against AFSC GAP and builder to create those
  47    queries.
  48    """
  49
  50    def __init__(self, base_url: OPT_STR = None, hauls_url: OPT_STR = None,
  51        requestor: OPT_REQUESTOR = None):
  52        """Create a new Query.
  53
  54        Args:
  55            base_url: The URL at which the API can be found. If None, will use
  56                default (offical URL at time of release). See
  57                afscgap.client.DEFAULT_URL.
  58            hauls_url: The URL at which the flat file with hauls metadata can be
  59                found or None if a default should be used. Defaults to None.
  60            requestor: Strategy to use for making HTTP requests. If None, will
  61                use a default as defined by afscgap.client.Cursor.
  62        """
  63        # URLs for data
  64        self._base_url = base_url
  65        self._hauls_url = hauls_url
  66        self._requestor = requestor
  67
  68        # Filter parameters
  69        self._year: FLOAT_PARAM = None
  70        self._srvy: STR_PARAM = None
  71        self._survey: STR_PARAM = None
  72        self._survey_id: FLOAT_PARAM = None
  73        self._cruise: FLOAT_PARAM = None
  74        self._haul: FLOAT_PARAM = None
  75        self._stratum: FLOAT_PARAM = None
  76        self._station: STR_PARAM = None
  77        self._vessel_name: STR_PARAM = None
  78        self._vessel_id: FLOAT_PARAM = None
  79        self._date_time: STR_PARAM = None
  80        self._latitude_dd: FLOAT_PARAM = None
  81        self._longitude_dd: FLOAT_PARAM = None
  82        self._species_code: FLOAT_PARAM = None
  83        self._common_name: STR_PARAM = None
  84        self._scientific_name: STR_PARAM = None
  85        self._taxon_confidence: STR_PARAM = None
  86        self._cpue_kgha: FLOAT_PARAM = None
  87        self._cpue_kgkm2: FLOAT_PARAM = None
  88        self._cpue_kg1000km2: FLOAT_PARAM = None
  89        self._cpue_noha: FLOAT_PARAM = None
  90        self._cpue_nokm2: FLOAT_PARAM = None
  91        self._cpue_no1000km2: FLOAT_PARAM = None
  92        self._weight_kg: FLOAT_PARAM = None
  93        self._count: FLOAT_PARAM = None
  94        self._bottom_temperature_c: FLOAT_PARAM = None
  95        self._surface_temperature_c: FLOAT_PARAM = None
  96        self._depth_m: FLOAT_PARAM = None
  97        self._distance_fished_km: FLOAT_PARAM = None
  98        self._net_width_m: FLOAT_PARAM = None
  99        self._net_height_m: FLOAT_PARAM = None
 100        self._area_swept_ha: FLOAT_PARAM = None
 101        self._duration_hr: FLOAT_PARAM = None
 102        self._tsn: INT_PARAM = None
 103        self._ak_survey_id: INT_PARAM = None
 104
 105        # Query pararmeters
 106        self._limit: OPT_INT = None
 107        self._start_offset: OPT_INT = None
 108        self._filter_incomplete: bool = False
 109        self._presence_only: bool = True
 110        self._suppress_large_warning: bool = False
 111        self._warn_function: WARN_FUNCTION = None
 112        self._hauls_prefetch: OPT_HAUL_LIST = None
 113
 114    def filter_year(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 115        max_val: OPT_FLOAT = None) -> 'Query':
 116        """Filter on year for the survey in which this observation was made.
 117
 118        Filter on year for the survey in which this observation was made,
 119        ovewritting all prior year filters on this Query if one was previously
 120        set.
 121
 122        Args:
 123            eq: The exact value that must be matched for a record to be
 124                returned. Pass None if no equality filter should be applied.
 125                Error thrown if min_val or max_val also provided. May also be
 126                a dictionary representing an ORDS query.
 127            min_val: The minimum allowed value, inclusive. Pass None if no
 128                minimum value filter should be applied. Defaults to None. Error
 129                thrown if eq also proivded.
 130            max_val: The maximum allowed value, inclusive. Pass None if no
 131                maximum value filter should be applied. Defaults to None. Error
 132                thrown if eq also proivded.
 133
 134        Returns:
 135            This object for chaining if desired.
 136        """
 137        self._year = self._create_float_param(eq, min_val, max_val)
 138        return self
 139
 140    def filter_srvy(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 141        max_val: OPT_STR = None) -> 'Query':
 142        """Filter on haul survey short name.
 143
 144        Filter on the short name of the survey in which this observation was
 145        made. Pass None if no filter should be applied. Defaults to None. Note
 146        that common values include: NBS (N Bearing Sea), EBS (SE Bearing Sea),
 147        BSS (Bearing Sea Slope), GOA (Gulf of Alaska), and AI (Aleutian
 148        Islands). Overwrites all prior srvy filters if set on this Query.
 149
 150        Args:
 151            eq: The exact value that must be matched for a record to be
 152                returned. Pass None if no equality filter should be applied.
 153                Error thrown if min_val or max_val also provided. May also be
 154                a dictionary representing an ORDS query.
 155            min_val: The minimum allowed value, inclusive. Pass None if no
 156                minimum value filter should be applied. Defaults to None. Error
 157                thrown if eq also proivded.
 158            max_val: The maximum allowed value, inclusive. Pass None if no
 159                maximum value filter should be applied. Defaults to None. Error
 160                thrown if eq also proivded.
 161
 162        Returns:
 163            This object for chaining if desired.
 164        """
 165        self._srvy = self._create_str_param(eq, min_val, max_val)
 166        return self
 167
 168    def filter_survey(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 169        max_val: OPT_STR = None) -> 'Query':
 170        """Filter on survey long name.
 171
 172        Filter on long form description of the survey in which the observation
 173        was made. Overwrites all prior survey filters if set on this Query.
 174
 175        Args:
 176            eq: The exact value that must be matched for a record to be
 177                returned. Pass None if no equality filter should be applied.
 178                Error thrown if min_val or max_val also provided. May also be
 179                a dictionary representing an ORDS query.
 180            min_val: The minimum allowed value, inclusive. Pass None if no
 181                minimum value filter should be applied. Defaults to None. Error
 182                thrown if eq also proivded.
 183            max_val: The maximum allowed value, inclusive. Pass None if no
 184                maximum value filter should be applied. Defaults to None. Error
 185                thrown if eq also proivded.
 186
 187        Returns:
 188            This object for chaining if desired.
 189        """
 190        self._survey = self._create_str_param(eq, min_val, max_val)
 191        return self
 192
 193    def filter_survey_id(self, eq: FLOAT_PARAM = None,
 194        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None) -> 'Query':
 195        """Filter on unique numeric ID for the survey.
 196
 197        Filter on unique numeric ID for the survey, overwritting prior survey ID
 198        filters if set on this Query.
 199
 200        Args:
 201            eq: The exact value that must be matched for a record to be
 202                returned. Pass None if no equality filter should be applied.
 203                Error thrown if min_val or max_val also provided. May also be
 204                a dictionary representing an ORDS query.
 205            min_val: The minimum allowed value, inclusive. Pass None if no
 206                minimum value filter should be applied. Defaults to None. Error
 207                thrown if eq also proivded.
 208            max_val: The maximum allowed value, inclusive. Pass None if no
 209                maximum value filter should be applied. Defaults to None. Error
 210                thrown if eq also proivded.
 211
 212        Returns:
 213            This object for chaining if desired.
 214        """
 215        self._survey_id = self._create_float_param(eq, min_val, max_val)
 216        return self
 217
 218    def filter_cruise(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 219        max_val: OPT_FLOAT = None) -> 'Query':
 220        """Filter on cruise ID.
 221
 222        Filter on an ID uniquely identifying the cruise in which the observation
 223        was made. Overwrites all prior cruise filters on this Query.
 224
 225        Args:
 226            eq: The exact value that must be matched for a record to be
 227                returned. Pass None if no equality filter should be applied.
 228                Error thrown if min_val or max_val also provided. May also be
 229                a dictionary representing an ORDS query.
 230            min_val: The minimum allowed value, inclusive. Pass None if no
 231                minimum value filter should be applied. Defaults to None. Error
 232                thrown if eq also proivded.
 233            max_val: The maximum allowed value, inclusive. Pass None if no
 234                maximum value filter should be applied. Defaults to None. Error
 235                thrown if eq also proivded.
 236
 237        Returns:
 238            This object for chaining if desired.
 239        """
 240        self._cruise = self._create_float_param(eq, min_val, max_val)
 241        return self
 242
 243    def filter_haul(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 244        max_val: OPT_FLOAT = None) -> 'Query':
 245        """Filter on haul identifier.
 246
 247        Filter on an ID uniquely identifying the haul in which this observation
 248        was made. Overwrites all prior haul filters on this Query.
 249
 250        Args:
 251            eq: The exact value that must be matched for a record to be
 252                returned. Pass None if no equality filter should be applied.
 253                Error thrown if min_val or max_val also provided. May also be
 254                a dictionary representing an ORDS query.
 255            min_val: The minimum allowed value, inclusive. Pass None if no
 256                minimum value filter should be applied. Defaults to None. Error
 257                thrown if eq also proivded.
 258            max_val: The maximum allowed value, inclusive. Pass None if no
 259                maximum value filter should be applied. Defaults to None. Error
 260                thrown if eq also proivded.
 261
 262        Returns:
 263            This object for chaining if desired.
 264        """
 265        self._haul = self._create_float_param(eq, min_val, max_val)
 266        return self
 267
 268    def filter_stratum(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 269        max_val: OPT_FLOAT = None) -> 'Query':
 270        """Filter on unique ID for statistical area / survey combination.
 271
 272        Filter on unique ID for statistical area / survey combination,
 273        overwritting all prior stratum filters on Query.
 274
 275        Args:
 276            eq: The exact value that must be matched for a record to be
 277                returned. Pass None if no equality filter should be applied.
 278                Error thrown if min_val or max_val also provided. May also be
 279                a dictionary representing an ORDS query.
 280            min_val: The minimum allowed value, inclusive. Pass None if no
 281                minimum value filter should be applied. Defaults to None. Error
 282                thrown if eq also proivded.
 283            max_val: The maximum allowed value, inclusive. Pass None if no
 284                maximum value filter should be applied. Defaults to None. Error
 285                thrown if eq also proivded.
 286
 287        Returns:
 288            This object for chaining if desired.
 289        """
 290        self._stratum = self._create_float_param(eq, min_val, max_val)
 291        return self
 292
 293    def filter_station(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 294        max_val: OPT_STR = None) -> 'Query':
 295        """Filter on station associated with the survey.
 296
 297        Filter on station associated with the survey, overwritting all prior
 298        station filters on this Query.
 299
 300        Args:
 301            eq: The exact value that must be matched for a record to be
 302                returned. Pass None if no equality filter should be applied.
 303                Error thrown if min_val or max_val also provided. May also be
 304                a dictionary representing an ORDS query.
 305            min_val: The minimum allowed value, inclusive. Pass None if no
 306                minimum value filter should be applied. Defaults to None. Error
 307                thrown if eq also proivded.
 308            max_val: The maximum allowed value, inclusive. Pass None if no
 309                maximum value filter should be applied. Defaults to None. Error
 310                thrown if eq also proivded.
 311
 312        Returns:
 313            This object for chaining if desired.
 314        """
 315        self._station = self._create_str_param(eq, min_val, max_val)
 316        return self
 317
 318    def filter_vessel_name(self, eq: STR_PARAM = None,
 319        min_val: OPT_STR = None, max_val: OPT_STR = None) -> 'Query':
 320        """Filter on unique ID describing the vessel that made this observation.
 321
 322        Filter on unique ID describing the vessel that made this observation,
 323        overwritting all prior vessel name filters on this Query.
 324
 325        Args:
 326            eq: The exact value that must be matched for a record to be
 327                returned. Pass None if no equality filter should be applied.
 328                Error thrown if min_val or max_val also provided. May also be
 329                a dictionary representing an ORDS query.
 330            min_val: The minimum allowed value, inclusive. Pass None if no
 331                minimum value filter should be applied. Defaults to None. Error
 332                thrown if eq also proivded.
 333            max_val: The maximum allowed value, inclusive. Pass None if no
 334                maximum value filter should be applied. Defaults to None. Error
 335                thrown if eq also proivded.
 336
 337        Returns:
 338            This object for chaining if desired.
 339        """
 340        self._vessel_name = self._create_str_param(eq, min_val, max_val)
 341        return self
 342
 343    def filter_vessel_id(self, eq: FLOAT_PARAM = None,
 344        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None) -> 'Query':
 345        """Filter on name of the vessel at the time the observation was made.
 346
 347        Filter on name of the vessel at the time the observation was made,
 348        overwritting all prior vessel ID filters on this Query.
 349
 350        Args:
 351            eq: The exact value that must be matched for a record to be
 352                returned. Pass None if no equality filter should be applied.
 353                Error thrown if min_val or max_val also provided. May also be
 354                a dictionary representing an ORDS query.
 355            min_val: The minimum allowed value, inclusive. Pass None if no
 356                minimum value filter should be applied. Defaults to None. Error
 357                thrown if eq also proivded.
 358            max_val: The maximum allowed value, inclusive. Pass None if no
 359                maximum value filter should be applied. Defaults to None. Error
 360                thrown if eq also proivded.
 361
 362        Returns:
 363            This object for chaining if desired.
 364        """
 365        self._vessel_id = self._create_float_param(eq, min_val, max_val)
 366        return self
 367
 368    def filter_date_time(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 369        max_val: OPT_STR = None) -> 'Query':
 370        """Filter on the date and time of the haul.
 371
 372        Filter on the date and time of the haul as an ISO 8601 string. If given
 373        an ISO 8601 string, will afscgap.convert from ISO 8601 to the API
 374        datetime string format. Similarly, if given a dictionary, all values
 375        matching an ISO 8601 string will be afscgap.converted to the API
 376        datetime string format. Overwrites all prior date time filters on
 377        this Query.
 378
 379        Args:
 380            eq: The exact value that must be matched for a record to be
 381                returned. Pass None if no equality filter should be applied.
 382                Error thrown if min_val or max_val also provided. May also be
 383                a dictionary representing an ORDS query.
 384            min_val: The minimum allowed value, inclusive. Pass None if no
 385                minimum value filter should be applied. Defaults to None. Error
 386                thrown if eq also proivded.
 387            max_val: The maximum allowed value, inclusive. Pass None if no
 388                maximum value filter should be applied. Defaults to None. Error
 389                thrown if eq also proivded.
 390
 391        Returns:
 392            This object for chaining if desired.
 393        """
 394        self._date_time = self._create_str_param(eq, min_val, max_val)
 395        return self
 396
 397    def filter_latitude(self, eq: FLOAT_PARAM = None,
 398        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 399        units: str = 'dd') -> 'Query':
 400        """Filter on latitude in decimal degrees associated with the haul.
 401
 402        Filter on latitude in decimal degrees associated with the haul,
 403        overwritting all prior latitude filters on this Query.
 404
 405        Args:
 406            eq: The exact value that must be matched for a record to be
 407                returned. Pass None if no equality filter should be applied.
 408                Error thrown if min_val or max_val also provided. May also be
 409                a dictionary representing an ORDS query.
 410            min_val: The minimum allowed value, inclusive. Pass None if no
 411                minimum value filter should be applied. Defaults to None. Error
 412                thrown if eq also proivded.
 413            max_val: The maximum allowed value, inclusive. Pass None if no
 414                maximum value filter should be applied. Defaults to None. Error
 415                thrown if eq also proivded.
 416            units: The units in which the filter values are provided. Currently
 417                only dd supported. Ignored if given eq value containing ORDS
 418                query.
 419
 420        Returns:
 421            This object for chaining if desired.
 422        """
 423        self._latitude_dd = self._create_float_param(
 424            afscgap.convert.unconvert_degrees(eq, units),
 425            afscgap.convert.unconvert_degrees(min_val, units),
 426            afscgap.convert.unconvert_degrees(max_val, units)
 427        )
 428        return self
 429
 430    def filter_longitude(self, eq: FLOAT_PARAM = None,
 431        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 432        units: str = 'dd') -> 'Query':
 433        """Filter on longitude in decimal degrees associated with the haul.
 434
 435        Filter on longitude in decimal degrees associated with the haul,
 436        overwritting all prior longitude filters on this Query.
 437
 438        Args:
 439            eq: The exact value that must be matched for a record to be
 440                returned. Pass None if no equality filter should be applied.
 441                Error thrown if min_val or max_val also provided. May also be
 442                a dictionary representing an ORDS query.
 443            min_val: The minimum allowed value, inclusive. Pass None if no
 444                minimum value filter should be applied. Defaults to None. Error
 445                thrown if eq also proivded.
 446            max_val: The maximum allowed value, inclusive. Pass None if no
 447                maximum value filter should be applied. Defaults to None. Error
 448                thrown if eq also proivded.
 449            units: The units in which the filter values are provided. Currently
 450                only dd supported.
 451
 452        Returns:
 453            This object for chaining if desired.
 454        """
 455        self._longitude_dd = self._create_float_param(
 456            afscgap.convert.unconvert_degrees(eq, units),
 457            afscgap.convert.unconvert_degrees(min_val, units),
 458            afscgap.convert.unconvert_degrees(max_val, units)
 459        )
 460        return self
 461
 462    def filter_species_code(self, eq: FLOAT_PARAM = None,
 463        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None) -> 'Query':
 464        """Filter on unique ID associated with the species observed.
 465
 466        Filter on unique ID associated with the species observed, overwritting
 467        all prior species code filters on this Query.
 468
 469        Args:
 470            eq: The exact value that must be matched for a record to be
 471                returned. Pass None if no equality filter should be applied.
 472                Error thrown if min_val or max_val also provided. May also be
 473                a dictionary representing an ORDS query.
 474            min_val: The minimum allowed value, inclusive. Pass None if no
 475                minimum value filter should be applied. Defaults to None. Error
 476                thrown if eq also proivded.
 477            max_val: The maximum allowed value, inclusive. Pass None if no
 478                maximum value filter should be applied. Defaults to None. Error
 479                thrown if eq also proivded.
 480
 481        Returns:
 482            This object for chaining if desired.
 483        """
 484        self._species_code = self._create_float_param(eq, min_val, max_val)
 485        return self
 486
 487    def filter_common_name(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
 488        max_val: OPT_STR = None) -> 'Query':
 489        """Filter on the "common name" associated with the species observed.
 490
 491        Filter on the "common name" associated with the species observed,
 492        overwritting all prior common name filters on this Query.
 493
 494        Args:
 495            eq: The exact value that must be matched for a record to be
 496                returned. Pass None if no equality filter should be applied.
 497                Error thrown if min_val or max_val also provided. May also be
 498                a dictionary representing an ORDS query.
 499            min_val: The minimum allowed value, inclusive. Pass None if no
 500                minimum value filter should be applied. Defaults to None. Error
 501                thrown if eq also proivded.
 502            max_val: The maximum allowed value, inclusive. Pass None if no
 503                maximum value filter should be applied. Defaults to None. Error
 504                thrown if eq also proivded.
 505
 506        Returns:
 507            This object for chaining if desired.
 508        """
 509        self._common_name = self._create_str_param(eq, min_val, max_val)
 510        return self
 511
 512    def filter_scientific_name(self, eq: STR_PARAM = None,
 513        min_val: OPT_STR = None, max_val: OPT_STR = None) -> 'Query':
 514        """Filter on the "scientific name" associated with the species observed.
 515
 516        Filter on the "scientific name" associated with the species observed,
 517        overwritting all prior scientific name filters on this Query.
 518
 519        Args:
 520            eq: The exact value that must be matched for a record to be
 521                returned. Pass None if no equality filter should be applied.
 522                Error thrown if min_val or max_val also provided. May also be
 523                a dictionary representing an ORDS query.
 524            min_val: The minimum allowed value, inclusive. Pass None if no
 525                minimum value filter should be applied. Defaults to None. Error
 526                thrown if eq also proivded.
 527            max_val: The maximum allowed value, inclusive. Pass None if no
 528                maximum value filter should be applied. Defaults to None. Error
 529                thrown if eq also proivded.
 530
 531        Returns:
 532            This object for chaining if desired.
 533        """
 534        self._scientific_name = self._create_str_param(eq, min_val, max_val)
 535        return self
 536
 537    def filter_taxon_confidence(self, eq: STR_PARAM = None,
 538        min_val: OPT_STR = None, max_val: OPT_STR = None) -> 'Query':
 539        """Filter on confidence flag regarding ability to identify species.
 540
 541        Filter on confidence flag regarding ability to identify species,
 542        overwritting all taxon confidence filters on this Query.
 543
 544        Args:
 545            eq: The exact value that must be matched for a record to be
 546                returned. Pass None if no equality filter should be applied.
 547                Error thrown if min_val or max_val also provided. May also be
 548                a dictionary representing an ORDS query.
 549            min_val: The minimum allowed value, inclusive. Pass None if no
 550                minimum value filter should be applied. Defaults to None. Error
 551                thrown if eq also proivded.
 552            max_val: The maximum allowed value, inclusive. Pass None if no
 553                maximum value filter should be applied. Defaults to None. Error
 554                thrown if eq also proivded.
 555
 556        Returns:
 557            This object for chaining if desired.
 558        """
 559        self._taxon_confidence = self._create_str_param(eq, min_val, max_val)
 560        return self
 561
 562    def filter_cpue_weight(self, eq: FLOAT_PARAM = None,
 563        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 564        units: str = 'kg/ha') -> 'Query':
 565        """Filter on catch per unit effort.
 566
 567        Filter on catch per unit effort as weight divided by net area if
 568        available. Overwrites all prior CPUE weight filters applied to this
 569        Query.
 570
 571        Args:
 572            eq: The exact value that must be matched for a record to be
 573                returned. Pass None if no equality filter should be applied.
 574                Error thrown if min_val or max_val also provided. May also be
 575                a dictionary representing an ORDS query.
 576            min_val: The minimum allowed value, inclusive. Pass None if no
 577                minimum value filter should be applied. Defaults to None. Error
 578                thrown if eq also proivded.
 579            max_val: The maximum allowed value, inclusive. Pass None if no
 580                maximum value filter should be applied. Defaults to None. Error
 581                thrown if eq also proivded.
 582            units: The units for the catch per unit effort provided. Options:
 583                kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha. Ignored if given
 584                eq value containing ORDS query.
 585
 586        Returns:
 587            This object for chaining if desired.
 588        """
 589        param = self._create_float_param(eq, min_val, max_val)
 590
 591        self._cpue_kgha = None
 592        self._cpue_kgkm2 = None
 593        self._cpue_kg1000km2 = None
 594
 595        if units == 'kg/ha':
 596            self._cpue_kgha = param
 597        elif units == 'kg/km2':
 598            self._cpue_kgkm2 = param
 599        elif units == 'kg1000/km2':
 600            self._cpue_kg1000km2 = param
 601        else:
 602            raise RuntimeError('Unrecognized units ' + units)
 603
 604        return self
 605
 606    def filter_cpue_count(self, eq: FLOAT_PARAM = None,
 607        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 608        units: str = 'count/ha') -> 'Query':
 609        """Filter catch per unit effort as count over area in hectares.
 610
 611        Filter on catch number divided by net sweep area if available (count /
 612        hectares). Overwrites all prior CPUE count filters applied to this
 613        Query.
 614
 615        Args:
 616            eq: The exact value that must be matched for a record to be
 617                returned. Pass None if no equality filter should be applied.
 618                Error thrown if min_val or max_val also provided. May also be
 619                a dictionary representing an ORDS query.
 620            min_val: The minimum allowed value, inclusive. Pass None if no
 621                minimum value filter should be applied. Defaults to None. Error
 622                thrown if eq also proivded.
 623            max_val: The maximum allowed value, inclusive. Pass None if no
 624                maximum value filter should be applied. Defaults to None. Error
 625                thrown if eq also proivded.
 626            units: The units for the given catch per unit effort. Options:
 627                count/ha, count/km2, and count1000/km2. Defaults to count/ha.
 628                Ignored if given eq value containing ORDS query.
 629
 630        Returns:
 631            This object for chaining if desired.
 632        """
 633        param = self._create_float_param(eq, min_val, max_val)
 634
 635        self._cpue_noha = None
 636        self._cpue_nokm2 = None
 637        self._cpue_no1000km2 = None
 638
 639        if units == 'count/ha':
 640            self._cpue_noha = param
 641        elif units == 'count/km2':
 642            self._cpue_nokm2 = param
 643        elif units == 'count1000/km2':
 644            self._cpue_no1000km2 = param
 645        else:
 646            raise RuntimeError('Unrecognized units ' + units)
 647
 648        return self
 649
 650    def filter_weight(self, eq: FLOAT_PARAM = None,
 651        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 652        units: str = 'kg') -> 'Query':
 653        """Filter on taxon weight (kg) if available.
 654
 655        Filter on taxon weight (kg) if available, overwrites all prior weight
 656        filters applied to this Query.
 657
 658        Args:
 659            eq: The exact value that must be matched for a record to be
 660                returned. Pass None if no equality filter should be applied.
 661                Error thrown if min_val or max_val also provided. May also be
 662                a dictionary representing an ORDS query.
 663            min_val: The minimum allowed value, inclusive. Pass None if no
 664                minimum value filter should be applied. Defaults to None. Error
 665                thrown if eq also proivded.
 666            max_val: The maximum allowed value, inclusive. Pass None if no
 667                maximum value filter should be applied. Defaults to None. Error
 668                thrown if eq also proivded.
 669            units: The units in which the weight are given. Options are
 670                g, kg for grams and kilograms respectively. Deafults to kg.
 671                Ignored if given eq value containing ORDS query.
 672
 673        Returns:
 674            This object for chaining if desired.
 675        """
 676        self._weight_kg = self._create_float_param(
 677            afscgap.convert.unconvert_weight(eq, units),
 678            afscgap.convert.unconvert_weight(min_val, units),
 679            afscgap.convert.unconvert_weight(max_val, units)
 680        )
 681        return self
 682
 683    def filter_count(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 684        max_val: OPT_FLOAT = None) -> 'Query':
 685        """Filter on total number of organism individuals in haul.
 686
 687        Filter on total number of organism individuals in haul, overwrites all
 688        prior count filters applied to this Query.
 689
 690        Args:
 691            eq: The exact value that must be matched for a record to be
 692                returned. Pass None if no equality filter should be applied.
 693                Error thrown if min_val or max_val also provided. May also be
 694                a dictionary representing an ORDS query.
 695            min_val: The minimum allowed value, inclusive. Pass None if no
 696                minimum value filter should be applied. Defaults to None. Error
 697                thrown if eq also proivded.
 698            max_val: The maximum allowed value, inclusive. Pass None if no
 699                maximum value filter should be applied. Defaults to None. Error
 700                thrown if eq also proivded. Ignored if given eq value containing
 701                ORDS query.
 702
 703        Returns:
 704            This object for chaining if desired.
 705        """
 706        self._count = self._create_float_param(eq, min_val, max_val)
 707        return self
 708
 709    def filter_bottom_temperature(self, eq: FLOAT_PARAM = None,
 710        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 711        units: str = 'c') -> 'Query':
 712        """Filter on bottom temperature.
 713
 714        Filter on bottom temperature associated with observation if available in
 715        the units given. Overwrites all prior bottom temperature filters applied
 716        to this Query.
 717
 718        Args:
 719            eq: The exact value that must be matched for a record to be
 720                returned. Pass None if no equality filter should be applied.
 721                Error thrown if min_val or max_val also provided. May also be
 722                a dictionary representing an ORDS query.
 723            min_val: The minimum allowed value, inclusive. Pass None if no
 724                minimum value filter should be applied. Defaults to None. Error
 725                thrown if eq also proivded.
 726            max_val: The maximum allowed value, inclusive. Pass None if no
 727                maximum value filter should be applied. Defaults to None. Error
 728                thrown if eq also proivded.
 729            units: The units in which the temperature filter values are given.
 730                Options: c or f for Celcius and Fahrenheit respectively.
 731                Defaults to c. Ignored if given eq value containing ORDS query.
 732
 733        Returns:
 734            This object for chaining if desired.
 735        """
 736        self._bottom_temperature_c = self._create_float_param(
 737            afscgap.convert.unconvert_temperature(eq, units),
 738            afscgap.convert.unconvert_temperature(min_val, units),
 739            afscgap.convert.unconvert_temperature(max_val, units)
 740        )
 741        return self
 742
 743    def filter_surface_temperature(self, eq: FLOAT_PARAM = None,
 744        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 745        units: str = 'c') -> 'Query':
 746        """Filter on surface temperature.
 747
 748        Filter on surface temperature associated with observation if available
 749        in the units given. Overwrites all prior bottom temperature filters
 750        applied to this Query.
 751
 752        Args:
 753            eq: The exact value that must be matched for a record to be
 754                returned. Pass None if no equality filter should be applied.
 755                Error thrown if min_val or max_val also provided. May also be
 756                a dictionary representing an ORDS query.
 757            min_val: The minimum allowed value, inclusive. Pass None if no
 758                minimum value filter should be applied. Defaults to None. Error
 759                thrown if eq also proivded.
 760            max_val: The maximum allowed value, inclusive. Pass None if no
 761                maximum value filter should be applied. Defaults to None. Error
 762                thrown if eq also proivded.
 763            units: The units in which the temperature filter values are given.
 764                Options: c or f for Celcius and Fahrenheit respectively.
 765                Defaults to c. Ignored if given eq value containing ORDS query.
 766
 767        Returns:
 768            This object for chaining if desired.
 769        """
 770        self._surface_temperature_c = self._create_float_param(
 771            afscgap.convert.unconvert_temperature(eq, units),
 772            afscgap.convert.unconvert_temperature(min_val, units),
 773            afscgap.convert.unconvert_temperature(max_val, units)
 774        )
 775        return self
 776
 777    def filter_depth(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
 778        max_val: OPT_FLOAT = None, units: str = 'm') -> 'Query':
 779        """Filter on depth of the bottom in meters.
 780
 781        Filter on depth of the bottom in meters, overwrites all prior depth
 782        filters applied to this Query.
 783
 784        Args:
 785            eq: The exact value that must be matched for a record to be
 786                returned. Pass None if no equality filter should be applied.
 787                Error thrown if min_val or max_val also provided. May also be
 788                a dictionary representing an ORDS query.
 789            min_val: The minimum allowed value, inclusive. Pass None if no
 790                minimum value filter should be applied. Defaults to None. Error
 791                thrown if eq also proivded.
 792            max_val: The maximum allowed value, inclusive. Pass None if no
 793                maximum value filter should be applied. Defaults to None. Error
 794                thrown if eq also proivded.
 795            units: The units in which the distance are given. Options:
 796                m or km for meters and kilometers respectively. Defaults to m.
 797                Ignored if given eq value containing ORDS query.
 798
 799        Returns:
 800            This object for chaining if desired.
 801        """
 802        self._depth_m = self._create_float_param(
 803            afscgap.convert.unconvert_distance(eq, units),
 804            afscgap.convert.unconvert_distance(min_val, units),
 805            afscgap.convert.unconvert_distance(max_val, units)
 806        )
 807        return self
 808
 809    def filter_distance_fished(self, eq: FLOAT_PARAM = None,
 810        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 811        units: str = 'm') -> 'Query':
 812        """Filter on distance of the net fished.
 813
 814        Filter on distance of the net fished, overwritting prior distance fished
 815        filters applied to this Query.
 816
 817        Args:
 818            eq: The exact value that must be matched for a record to be
 819                returned. Pass None if no equality filter should be applied.
 820                Error thrown if min_val or max_val also provided. May also be
 821                a dictionary representing an ORDS query.
 822            min_val: The minimum allowed value, inclusive. Pass None if no
 823                minimum value filter should be applied. Defaults to None. Error
 824                thrown if eq also proivded.
 825            max_val: The maximum allowed value, inclusive. Pass None if no
 826                maximum value filter should be applied. Defaults to None. Error
 827                thrown if eq also proivded.
 828            units: The units in which the distance values are given. Options:
 829                m or km for meters and kilometers respectively. Defaults to m.
 830                Ignored if given eq value containing ORDS query.
 831
 832        Returns:
 833            This object for chaining if desired.
 834        """
 835        def convert_to_km(target, units):
 836            in_meters = afscgap.convert.unconvert_distance(target, units)
 837            return afscgap.convert.convert_distance(in_meters, 'km')
 838
 839        self._distance_fished_km = self._create_float_param(
 840            convert_to_km(eq, units),
 841            convert_to_km(min_val, units),
 842            convert_to_km(max_val, units)
 843        )
 844        return self
 845
 846    def filter_net_width(self, eq: FLOAT_PARAM = None,
 847        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 848        units: str = 'm') -> 'Query':
 849        """Filter on distance of the net fished.
 850
 851        Filter on distance of the net fished, overwritting prior net width
 852        filters applied to this Query.
 853
 854        Args:
 855            eq: The exact value that must be matched for a record to be
 856                returned. Pass None if no equality filter should be applied.
 857                Error thrown if min_val or max_val also provided. May also be
 858                a dictionary representing an ORDS query.
 859            min_val: The minimum allowed value, inclusive. Pass None if no
 860                minimum value filter should be applied. Defaults to None. Error
 861                thrown if eq also proivded.
 862            max_val: The maximum allowed value, inclusive. Pass None if no
 863                maximum value filter should be applied. Defaults to None. Error
 864                thrown if eq also proivded.
 865            units: The units in which the distance should be returned. Options:
 866                m or km for meters and kilometers respectively. Defaults to m.
 867
 868        Returns:
 869            This object for chaining if desired.
 870        """
 871        self._net_width_m = self._create_float_param(
 872            afscgap.convert.unconvert_distance(eq, units),
 873            afscgap.convert.unconvert_distance(min_val, units),
 874            afscgap.convert.unconvert_distance(max_val, units)
 875        )
 876        return self
 877
 878    def filter_net_height(self, eq: FLOAT_PARAM = None,
 879        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 880        units: str = 'm') -> 'Query':
 881        """Filter on height of the net fished.
 882
 883        Filter on height of the net fished, overwritting prior net height
 884        filters applied to this Query.
 885
 886        Args:
 887            eq: The exact value that must be matched for a record to be
 888                returned. Pass None if no equality filter should be applied.
 889                Error thrown if min_val or max_val also provided. May also be
 890                a dictionary representing an ORDS query.
 891            min_val: The minimum allowed value, inclusive. Pass None if no
 892                minimum value filter should be applied. Defaults to None. Error
 893                thrown if eq also proivded.
 894            max_val: The maximum allowed value, inclusive. Pass None if no
 895                maximum value filter should be applied. Defaults to None. Error
 896                thrown if eq also proivded.
 897            units: The units in which the distance should be returned. Options:
 898                m or km for meters and kilometers respectively. Defaults to m.
 899
 900        Returns:
 901            This object for chaining if desired.
 902        """
 903        self._net_height_m = self._create_float_param(
 904            afscgap.convert.unconvert_distance(eq, units),
 905            afscgap.convert.unconvert_distance(min_val, units),
 906            afscgap.convert.unconvert_distance(max_val, units)
 907        )
 908        return self
 909
 910    def filter_area_swept(self, eq: FLOAT_PARAM = None,
 911        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 912        units: str = 'm') -> 'Query':
 913        """Filter on area covered by the net while fishing.
 914
 915        Filter on area covered by the net while fishing, overwritting prior
 916        area swept filters applied to this Query.
 917
 918        Args:
 919            eq: The exact value that must be matched for a record to be
 920                returned. Pass None if no equality filter should be applied.
 921                Error thrown if min_val or max_val also provided. May also be
 922                a dictionary representing an ORDS query.
 923            min_val: The minimum allowed value, inclusive. Pass None if no
 924                minimum value filter should be applied. Defaults to None. Error
 925                thrown if eq also proivded.
 926            max_val: The maximum allowed value, inclusive. Pass None if no
 927                maximum value filter should be applied. Defaults to None. Error
 928                thrown if eq also proivded.
 929            units: The units in which the area should be returned. Options:
 930                ha, m2, km2. Defaults to ha.
 931
 932        Returns:
 933            This object for chaining if desired.
 934        """
 935        self._area_swept_ha = self._create_float_param(
 936            afscgap.convert.unconvert_area(eq, units),
 937            afscgap.convert.unconvert_area(min_val, units),
 938            afscgap.convert.unconvert_area(max_val, units)
 939        )
 940        return self
 941
 942    def filter_duration(self, eq: FLOAT_PARAM = None,
 943        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
 944        units: str = 'hr') -> 'Query':
 945        """Filter on duration of the haul.
 946
 947        Filter on duration of the haul, ovewritting all prior duration filters
 948        applied to this Query.
 949
 950        Args:
 951            eq: The exact value that must be matched for a record to be
 952                returned. Pass None if no equality filter should be applied.
 953                Error thrown if min_val or max_val also provided. May also be
 954                a dictionary representing an ORDS query.
 955            min_val: The minimum allowed value, inclusive. Pass None if no
 956                minimum value filter should be applied. Defaults to None. Error
 957                thrown if eq also proivded.
 958            max_val: The maximum allowed value, inclusive. Pass None if no
 959                maximum value filter should be applied. Defaults to None. Error
 960                thrown if eq also proivded.
 961            units: The units in which the duration should be returned. Options:
 962                day, hr, min. Defaults to hr.
 963
 964        Returns:
 965            This object for chaining if desired.
 966        """
 967        self._duration_hr = self._create_float_param(
 968            afscgap.convert.unconvert_time(eq, units),
 969            afscgap.convert.unconvert_time(min_val, units),
 970            afscgap.convert.unconvert_time(max_val, units)
 971        )
 972        return self
 973
 974    def filter_tsn(self, eq: INT_PARAM = None, min_val: OPT_INT = None,
 975        max_val: OPT_INT = None) -> 'Query':
 976        """Filter on taxonomic information system species code.
 977
 978        Filter on taxonomic information system species code, overwritting all
 979        prior TSN filters applied to this Query.
 980
 981        Args:
 982            eq: The exact value that must be matched for a record to be
 983                returned. Pass None if no equality filter should be applied.
 984                Error thrown if min_val or max_val also provided. May also be
 985                a dictionary representing an ORDS query.
 986            min_val: The minimum allowed value, inclusive. Pass None if no
 987                minimum value filter should be applied. Defaults to None. Error
 988                thrown if eq also proivded.
 989            max_val: The maximum allowed value, inclusive. Pass None if no
 990                maximum value filter should be applied. Defaults to None. Error
 991                thrown if eq also proivded.
 992
 993        Returns:
 994            This object for chaining if desired.
 995        """
 996        self._tsn = self._create_int_param(eq, min_val, max_val)
 997        return self
 998
 999    def filter_ak_survey_id(self, eq: INT_PARAM = None, min_val: OPT_INT = None,
1000        max_val: OPT_INT = None) -> 'Query':
1001        """Filter on AK identifier for the survey.
1002
1003        Filter on AK identifier for the survey, overwritting all prior AK ID
1004        filters applied to this Query.
1005
1006        Args:
1007            eq: The exact value that must be matched for a record to be
1008                returned. Pass None if no equality filter should be applied.
1009                Error thrown if min_val or max_val also provided. May also be
1010                a dictionary representing an ORDS query.
1011            min_val: The minimum allowed value, inclusive. Pass None if no
1012                minimum value filter should be applied. Defaults to None. Error
1013                thrown if eq also proivded.
1014            max_val: The maximum allowed value, inclusive. Pass None if no
1015                maximum value filter should be applied. Defaults to None. Error
1016                thrown if eq also proivded.
1017
1018        Returns:
1019            This object for chaining if desired.
1020        """
1021        self._ak_survey_id = self._create_int_param(eq, min_val, max_val)
1022        return self
1023
1024    def set_limit(self, limit: OPT_INT) -> 'Query':
1025        """Set the max number of results.
1026
1027        Set the max number of results, overwritting prior limit settings on this
1028        Query.
1029
1030        Args:
1031            limit: The maximum number of results to retrieve per HTTP request.
1032                If None or not provided, will use API's default.
1033
1034        Returns:
1035            This object for chaining if desired.
1036        """
1037        self._limit = limit
1038        return self
1039
1040    def set_start_offset(self, start_offset: OPT_INT) -> 'Query':
1041        """Indicate how many results to skip.
1042
1043        Indicate how many results to skip, overwritting prior offset settings on
1044        this Query.
1045
1046        Args:
1047            start_offset: The number of initial results to skip in retrieving
1048                results. If None or not provided, none will be skipped.
1049
1050        Returns:
1051            This object for chaining if desired.
1052        """
1053        self._start_offset = start_offset
1054        return self
1055
1056    def set_filter_incomplete(self, filter_incomplete: bool) -> 'Query':
1057        """Indicate if incomplete records should be filtered out.
1058
1059        Indicate if incomplete records should be filtered out, overwritting
1060        prior incomplete filter settings on this Query.
1061
1062        Args:
1063            filter_incomplete: Flag indicating if "incomplete" records should be
1064                filtered. If true, "incomplete" records are silently filtered
1065                from the results, putting them in the invalid records queue. If
1066                false, they are included and their is_complete() will return
1067                false. Defaults to false.
1068
1069        Returns:
1070            This object for chaining if desired.
1071        """
1072        self._filter_incomplete = filter_incomplete
1073        return self
1074
1075    def set_presence_only(self, presence_only: bool) -> 'Query':
1076        """Indicate if zero catch inference should be enabled.
1077
1078        Indicate if zero catch inference should be enabled, overwritting prior
1079        abscence / zero catch data settings on this Query.
1080
1081        Args:
1082            presence_only: Flag indicating if abscence / zero catch data should
1083                be inferred. If false, will run abscence data inference. If
1084                true, will return presence only data as returned by the NOAA API
1085                service. Defaults to true.
1086
1087        Returns:
1088            This object for chaining if desired.
1089        """
1090        self._presence_only = presence_only
1091        return self
1092
1093    def set_suppress_large_warning(self, supress: bool) -> 'Query':
1094        """Indicate if the large results warning should be supressed.
1095
1096        Indicate if the large results warning should be supressed, overwritting
1097        prior large results warning supressions settings on this Query.
1098
1099        Args:
1100            suppress_large_warning: Indicate if the library should warn when an
1101                operation may consume a large amount of memory. If true, the
1102                warning will not be emitted. Defaults to true.
1103
1104        Returns:
1105            This object for chaining if desired.
1106        """
1107        self._suppress_large_warning = supress
1108        return self
1109
1110    def set_warn_function(self, warn_function: WARN_FUNCTION) -> 'Query':
1111        """Indicate how warnings should be emitted.
1112
1113        Indicate how warnings should be emitted, overwritting the prior warning
1114        function settings on this Query.
1115
1116        Args:
1117            warn_function: Function to call with a message describing warnings
1118                encountered. If None, will use warnings.warn. Defaults to None.
1119
1120        Returns:
1121            This object for chaining if desired.
1122        """
1123        self._warn_function = warn_function
1124        return self
1125
1126    def set_hauls_prefetch(self, hauls_prefetch: OPT_HAUL_LIST) -> 'Query':
1127        """Indicate if hauls' data were prefetched.
1128
1129        Indicate if hauls' data were prefetched, overwritting prior prefetch
1130        settings on this Query.
1131
1132        Args:
1133            hauls_prefetch: If using presence_only=True, this is ignored.
1134                Otherwise, if None, will instruct the library to download hauls
1135                metadata. If not None, will use this as the hauls list for zero
1136                catch record inference.
1137
1138        Returns:
1139            This object for chaining if desired.
1140        """
1141        self._hauls_prefetch = hauls_prefetch
1142        return self
1143
1144    def execute(self) -> afscgap.cursor.Cursor:
1145        """Execute the query built up in this object.
1146
1147        Execute the query built up in this object using its current state. Note
1148        that later changes to this builder will not impact prior returned
1149        Cursors from execute.
1150
1151        Returns:
1152            Cursor to manage HTTP requests and query results.
1153        """
1154        all_dict_raw = {
1155            'year': self._year,
1156            'srvy': self._srvy,
1157            'survey': self._survey,
1158            'survey_id': self._survey_id,
1159            'cruise': self._cruise,
1160            'haul': self._haul,
1161            'stratum': self._stratum,
1162            'station': self._station,
1163            'vessel_name': self._vessel_name,
1164            'vessel_id': self._vessel_id,
1165            'date_time': self._date_time,
1166            'latitude_dd': self._latitude_dd,
1167            'longitude_dd': self._longitude_dd,
1168            'species_code': self._species_code,
1169            'common_name': self._common_name,
1170            'scientific_name': self._scientific_name,
1171            'taxon_confidence': self._taxon_confidence,
1172            'cpue_kgha': self._cpue_kgha,
1173            'cpue_kgkm2': self._cpue_kgkm2,
1174            'cpue_kg1000km2': self._cpue_kg1000km2,
1175            'cpue_noha': self._cpue_noha,
1176            'cpue_nokm2': self._cpue_nokm2,
1177            'cpue_no1000km2': self._cpue_no1000km2,
1178            'weight_kg': self._weight_kg,
1179            'count': self._count,
1180            'bottom_temperature_c': self._bottom_temperature_c,
1181            'surface_temperature_c': self._surface_temperature_c,
1182            'depth_m': self._depth_m,
1183            'distance_fished_km': self._distance_fished_km,
1184            'net_width_m': self._net_width_m,
1185            'net_height_m': self._net_height_m,
1186            'area_swept_ha': self._area_swept_ha,
1187            'duration_hr': self._duration_hr,
1188            'tsn': self._tsn,
1189            'ak_survey_id': self._ak_survey_id
1190        }
1191
1192        api_cursor = afscgap.client.build_api_cursor(
1193            all_dict_raw,
1194            limit=self._limit,
1195            start_offset=self._start_offset,
1196            filter_incomplete=self._filter_incomplete,
1197            requestor=self._requestor,
1198            base_url=self._base_url
1199        )
1200
1201        if self._presence_only:
1202            return api_cursor
1203
1204        decorated_cursor = afscgap.inference.build_inference_cursor(
1205            all_dict_raw,
1206            api_cursor,
1207            requestor=self._requestor,
1208            hauls_url=self._hauls_url,
1209            hauls_prefetch=self._hauls_prefetch
1210        )
1211
1212        if not self._suppress_large_warning:
1213            warn_function = self._warn_function
1214            if not warn_function:
1215                warn_function = lambda x: warnings.warn(x)
1216
1217            warn_function(LARGE_WARNING)
1218
1219        return decorated_cursor
1220
1221    def _create_str_param(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
1222        max_val: OPT_STR = None) -> STR_PARAM:
1223        """Create a new string parameter.
1224
1225        Args:
1226            eq: The exact value that must be matched for a record to be
1227                returned. Pass None if no equality filter should be applied.
1228                Error thrown if min_val or max_val also provided. May also be
1229                a dictionary representing an ORDS query.
1230            min_val: The minimum allowed value, inclusive. Pass None if no
1231                minimum value filter should be applied. Defaults to None. Error
1232                thrown if eq also proivded.
1233            max_val: The maximum allowed value, inclusive. Pass None if no
1234                maximum value filter should be applied. Defaults to None. Error
1235                thrown if eq also proivded.
1236
1237        """
1238        return self._create_param(eq, min_val, max_val)  # type: ignore
1239
1240    def _create_float_param(self, eq: FLOAT_PARAM = None,
1241        min_val: FLOAT_PARAM = None,
1242        max_val: FLOAT_PARAM = None) -> FLOAT_PARAM:
1243        """Create a new float parameter.
1244
1245        Args:
1246            eq: The exact value that must be matched for a record to be
1247                returned. Pass None if no equality filter should be applied.
1248                Error thrown if min_val or max_val also provided. May also be
1249                a dictionary representing an ORDS query.
1250            min_val: The minimum allowed value, inclusive. Pass None if no
1251                minimum value filter should be applied. Defaults to None. Error
1252                thrown if eq also proivded.
1253            max_val: The maximum allowed value, inclusive. Pass None if no
1254                maximum value filter should be applied. Defaults to None. Error
1255                thrown if eq also proivded.
1256        """
1257        return self._create_param(eq, min_val, max_val)  # type: ignore
1258
1259    def _create_int_param(self, eq: INT_PARAM = None, min_val: OPT_INT = None,
1260        max_val: OPT_INT = None) -> INT_PARAM:
1261        """Create a new int parameter.
1262
1263        Args:
1264            eq: The exact value that must be matched for a record to be
1265                returned. Pass None if no equality filter should be applied.
1266                Error thrown if min_val or max_val also provided. May also be
1267                a dictionary representing an ORDS query.
1268            min_val: The minimum allowed value, inclusive. Pass None if no
1269                minimum value filter should be applied. Defaults to None. Error
1270                thrown if eq also proivded.
1271            max_val: The maximum allowed value, inclusive. Pass None if no
1272                maximum value filter should be applied. Defaults to None. Error
1273                thrown if eq also proivded.
1274        Returns:
1275            Compatible param representation.
1276        """
1277        return self._create_param(eq, min_val, max_val)  # type: ignore
1278
1279    def _create_param(self, eq=None, min_val=None, max_val=None):
1280        """Create a new parameter.
1281
1282        Args:
1283            eq: The exact value that must be matched for a record to be
1284                returned. Pass None if no equality filter should be applied.
1285                Error thrown if min_val or max_val also provided. May also be
1286                a dictionary representing an ORDS query.
1287            min_val: The minimum allowed value, inclusive. Pass None if no
1288                minimum value filter should be applied. Defaults to None. Error
1289                thrown if eq also proivded.
1290            max_val: The maximum allowed value, inclusive. Pass None if no
1291                maximum value filter should be applied. Defaults to None. Error
1292                thrown if eq also proivded.
1293        Returns:
1294            Compatible param representation.
1295        """
1296        eq_given = eq is not None
1297        min_val_given = min_val is not None
1298        max_val_given = max_val is not None
1299
1300        if eq_given and (min_val_given and max_val_given):
1301            raise RuntimeError('Cannot query with both eq and min/max val.')
1302
1303        if eq_given:
1304            return eq
1305        elif min_val_given or max_val_given:
1306            return [min_val, max_val]
1307        else:
1308            return None

Entrypoint for the AFSC GAP Python library.

Facade for executing queries against AFSC GAP and builder to create those queries.

Query( base_url: Optional[str] = None, hauls_url: Optional[str] = None, requestor: Optional[Callable[[str], requests.models.Response]] = None)
 50    def __init__(self, base_url: OPT_STR = None, hauls_url: OPT_STR = None,
 51        requestor: OPT_REQUESTOR = None):
 52        """Create a new Query.
 53
 54        Args:
 55            base_url: The URL at which the API can be found. If None, will use
 56                default (offical URL at time of release). See
 57                afscgap.client.DEFAULT_URL.
 58            hauls_url: The URL at which the flat file with hauls metadata can be
 59                found or None if a default should be used. Defaults to None.
 60            requestor: Strategy to use for making HTTP requests. If None, will
 61                use a default as defined by afscgap.client.Cursor.
 62        """
 63        # URLs for data
 64        self._base_url = base_url
 65        self._hauls_url = hauls_url
 66        self._requestor = requestor
 67
 68        # Filter parameters
 69        self._year: FLOAT_PARAM = None
 70        self._srvy: STR_PARAM = None
 71        self._survey: STR_PARAM = None
 72        self._survey_id: FLOAT_PARAM = None
 73        self._cruise: FLOAT_PARAM = None
 74        self._haul: FLOAT_PARAM = None
 75        self._stratum: FLOAT_PARAM = None
 76        self._station: STR_PARAM = None
 77        self._vessel_name: STR_PARAM = None
 78        self._vessel_id: FLOAT_PARAM = None
 79        self._date_time: STR_PARAM = None
 80        self._latitude_dd: FLOAT_PARAM = None
 81        self._longitude_dd: FLOAT_PARAM = None
 82        self._species_code: FLOAT_PARAM = None
 83        self._common_name: STR_PARAM = None
 84        self._scientific_name: STR_PARAM = None
 85        self._taxon_confidence: STR_PARAM = None
 86        self._cpue_kgha: FLOAT_PARAM = None
 87        self._cpue_kgkm2: FLOAT_PARAM = None
 88        self._cpue_kg1000km2: FLOAT_PARAM = None
 89        self._cpue_noha: FLOAT_PARAM = None
 90        self._cpue_nokm2: FLOAT_PARAM = None
 91        self._cpue_no1000km2: FLOAT_PARAM = None
 92        self._weight_kg: FLOAT_PARAM = None
 93        self._count: FLOAT_PARAM = None
 94        self._bottom_temperature_c: FLOAT_PARAM = None
 95        self._surface_temperature_c: FLOAT_PARAM = None
 96        self._depth_m: FLOAT_PARAM = None
 97        self._distance_fished_km: FLOAT_PARAM = None
 98        self._net_width_m: FLOAT_PARAM = None
 99        self._net_height_m: FLOAT_PARAM = None
100        self._area_swept_ha: FLOAT_PARAM = None
101        self._duration_hr: FLOAT_PARAM = None
102        self._tsn: INT_PARAM = None
103        self._ak_survey_id: INT_PARAM = None
104
105        # Query pararmeters
106        self._limit: OPT_INT = None
107        self._start_offset: OPT_INT = None
108        self._filter_incomplete: bool = False
109        self._presence_only: bool = True
110        self._suppress_large_warning: bool = False
111        self._warn_function: WARN_FUNCTION = None
112        self._hauls_prefetch: OPT_HAUL_LIST = None

Create a new Query.

Arguments:
  • base_url: The URL at which the API can be found. If None, will use default (offical URL at time of release). See afscgap.client.DEFAULT_URL.
  • hauls_url: The URL at which the flat file with hauls metadata can be found or None if a default should be used. Defaults to None.
  • requestor: Strategy to use for making HTTP requests. If None, will use a default as defined by afscgap.client.Cursor.
def filter_year( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None) -> Query:
114    def filter_year(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
115        max_val: OPT_FLOAT = None) -> 'Query':
116        """Filter on year for the survey in which this observation was made.
117
118        Filter on year for the survey in which this observation was made,
119        ovewritting all prior year filters on this Query if one was previously
120        set.
121
122        Args:
123            eq: The exact value that must be matched for a record to be
124                returned. Pass None if no equality filter should be applied.
125                Error thrown if min_val or max_val also provided. May also be
126                a dictionary representing an ORDS query.
127            min_val: The minimum allowed value, inclusive. Pass None if no
128                minimum value filter should be applied. Defaults to None. Error
129                thrown if eq also proivded.
130            max_val: The maximum allowed value, inclusive. Pass None if no
131                maximum value filter should be applied. Defaults to None. Error
132                thrown if eq also proivded.
133
134        Returns:
135            This object for chaining if desired.
136        """
137        self._year = self._create_float_param(eq, min_val, max_val)
138        return self

Filter on year for the survey in which this observation was made.

Filter on year for the survey in which this observation was made, ovewritting all prior year filters on this Query if one was previously set.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_srvy( self, eq: Union[str, dict, NoneType] = None, min_val: Optional[str] = None, max_val: Optional[str] = None) -> Query:
140    def filter_srvy(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
141        max_val: OPT_STR = None) -> 'Query':
142        """Filter on haul survey short name.
143
144        Filter on the short name of the survey in which this observation was
145        made. Pass None if no filter should be applied. Defaults to None. Note
146        that common values include: NBS (N Bearing Sea), EBS (SE Bearing Sea),
147        BSS (Bearing Sea Slope), GOA (Gulf of Alaska), and AI (Aleutian
148        Islands). Overwrites all prior srvy filters if set on this Query.
149
150        Args:
151            eq: The exact value that must be matched for a record to be
152                returned. Pass None if no equality filter should be applied.
153                Error thrown if min_val or max_val also provided. May also be
154                a dictionary representing an ORDS query.
155            min_val: The minimum allowed value, inclusive. Pass None if no
156                minimum value filter should be applied. Defaults to None. Error
157                thrown if eq also proivded.
158            max_val: The maximum allowed value, inclusive. Pass None if no
159                maximum value filter should be applied. Defaults to None. Error
160                thrown if eq also proivded.
161
162        Returns:
163            This object for chaining if desired.
164        """
165        self._srvy = self._create_str_param(eq, min_val, max_val)
166        return self

Filter on haul survey short name.

Filter on the short name of the survey in which this observation was made. Pass None if no filter should be applied. Defaults to None. Note that common values include: NBS (N Bearing Sea), EBS (SE Bearing Sea), BSS (Bearing Sea Slope), GOA (Gulf of Alaska), and AI (Aleutian Islands). Overwrites all prior srvy filters if set on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_survey( self, eq: Union[str, dict, NoneType] = None, min_val: Optional[str] = None, max_val: Optional[str] = None) -> Query:
168    def filter_survey(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
169        max_val: OPT_STR = None) -> 'Query':
170        """Filter on survey long name.
171
172        Filter on long form description of the survey in which the observation
173        was made. Overwrites all prior survey filters if set on this Query.
174
175        Args:
176            eq: The exact value that must be matched for a record to be
177                returned. Pass None if no equality filter should be applied.
178                Error thrown if min_val or max_val also provided. May also be
179                a dictionary representing an ORDS query.
180            min_val: The minimum allowed value, inclusive. Pass None if no
181                minimum value filter should be applied. Defaults to None. Error
182                thrown if eq also proivded.
183            max_val: The maximum allowed value, inclusive. Pass None if no
184                maximum value filter should be applied. Defaults to None. Error
185                thrown if eq also proivded.
186
187        Returns:
188            This object for chaining if desired.
189        """
190        self._survey = self._create_str_param(eq, min_val, max_val)
191        return self

Filter on survey long name.

Filter on long form description of the survey in which the observation was made. Overwrites all prior survey filters if set on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_survey_id( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None) -> Query:
193    def filter_survey_id(self, eq: FLOAT_PARAM = None,
194        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None) -> 'Query':
195        """Filter on unique numeric ID for the survey.
196
197        Filter on unique numeric ID for the survey, overwritting prior survey ID
198        filters if set on this Query.
199
200        Args:
201            eq: The exact value that must be matched for a record to be
202                returned. Pass None if no equality filter should be applied.
203                Error thrown if min_val or max_val also provided. May also be
204                a dictionary representing an ORDS query.
205            min_val: The minimum allowed value, inclusive. Pass None if no
206                minimum value filter should be applied. Defaults to None. Error
207                thrown if eq also proivded.
208            max_val: The maximum allowed value, inclusive. Pass None if no
209                maximum value filter should be applied. Defaults to None. Error
210                thrown if eq also proivded.
211
212        Returns:
213            This object for chaining if desired.
214        """
215        self._survey_id = self._create_float_param(eq, min_val, max_val)
216        return self

Filter on unique numeric ID for the survey.

Filter on unique numeric ID for the survey, overwritting prior survey ID filters if set on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_cruise( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None) -> Query:
218    def filter_cruise(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
219        max_val: OPT_FLOAT = None) -> 'Query':
220        """Filter on cruise ID.
221
222        Filter on an ID uniquely identifying the cruise in which the observation
223        was made. Overwrites all prior cruise filters on this Query.
224
225        Args:
226            eq: The exact value that must be matched for a record to be
227                returned. Pass None if no equality filter should be applied.
228                Error thrown if min_val or max_val also provided. May also be
229                a dictionary representing an ORDS query.
230            min_val: The minimum allowed value, inclusive. Pass None if no
231                minimum value filter should be applied. Defaults to None. Error
232                thrown if eq also proivded.
233            max_val: The maximum allowed value, inclusive. Pass None if no
234                maximum value filter should be applied. Defaults to None. Error
235                thrown if eq also proivded.
236
237        Returns:
238            This object for chaining if desired.
239        """
240        self._cruise = self._create_float_param(eq, min_val, max_val)
241        return self

Filter on cruise ID.

Filter on an ID uniquely identifying the cruise in which the observation was made. Overwrites all prior cruise filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_haul( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None) -> Query:
243    def filter_haul(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
244        max_val: OPT_FLOAT = None) -> 'Query':
245        """Filter on haul identifier.
246
247        Filter on an ID uniquely identifying the haul in which this observation
248        was made. Overwrites all prior haul filters on this Query.
249
250        Args:
251            eq: The exact value that must be matched for a record to be
252                returned. Pass None if no equality filter should be applied.
253                Error thrown if min_val or max_val also provided. May also be
254                a dictionary representing an ORDS query.
255            min_val: The minimum allowed value, inclusive. Pass None if no
256                minimum value filter should be applied. Defaults to None. Error
257                thrown if eq also proivded.
258            max_val: The maximum allowed value, inclusive. Pass None if no
259                maximum value filter should be applied. Defaults to None. Error
260                thrown if eq also proivded.
261
262        Returns:
263            This object for chaining if desired.
264        """
265        self._haul = self._create_float_param(eq, min_val, max_val)
266        return self

Filter on haul identifier.

Filter on an ID uniquely identifying the haul in which this observation was made. Overwrites all prior haul filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_stratum( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None) -> Query:
268    def filter_stratum(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
269        max_val: OPT_FLOAT = None) -> 'Query':
270        """Filter on unique ID for statistical area / survey combination.
271
272        Filter on unique ID for statistical area / survey combination,
273        overwritting all prior stratum filters on Query.
274
275        Args:
276            eq: The exact value that must be matched for a record to be
277                returned. Pass None if no equality filter should be applied.
278                Error thrown if min_val or max_val also provided. May also be
279                a dictionary representing an ORDS query.
280            min_val: The minimum allowed value, inclusive. Pass None if no
281                minimum value filter should be applied. Defaults to None. Error
282                thrown if eq also proivded.
283            max_val: The maximum allowed value, inclusive. Pass None if no
284                maximum value filter should be applied. Defaults to None. Error
285                thrown if eq also proivded.
286
287        Returns:
288            This object for chaining if desired.
289        """
290        self._stratum = self._create_float_param(eq, min_val, max_val)
291        return self

Filter on unique ID for statistical area / survey combination.

Filter on unique ID for statistical area / survey combination, overwritting all prior stratum filters on Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_station( self, eq: Union[str, dict, NoneType] = None, min_val: Optional[str] = None, max_val: Optional[str] = None) -> Query:
293    def filter_station(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
294        max_val: OPT_STR = None) -> 'Query':
295        """Filter on station associated with the survey.
296
297        Filter on station associated with the survey, overwritting all prior
298        station filters on this Query.
299
300        Args:
301            eq: The exact value that must be matched for a record to be
302                returned. Pass None if no equality filter should be applied.
303                Error thrown if min_val or max_val also provided. May also be
304                a dictionary representing an ORDS query.
305            min_val: The minimum allowed value, inclusive. Pass None if no
306                minimum value filter should be applied. Defaults to None. Error
307                thrown if eq also proivded.
308            max_val: The maximum allowed value, inclusive. Pass None if no
309                maximum value filter should be applied. Defaults to None. Error
310                thrown if eq also proivded.
311
312        Returns:
313            This object for chaining if desired.
314        """
315        self._station = self._create_str_param(eq, min_val, max_val)
316        return self

Filter on station associated with the survey.

Filter on station associated with the survey, overwritting all prior station filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_vessel_name( self, eq: Union[str, dict, NoneType] = None, min_val: Optional[str] = None, max_val: Optional[str] = None) -> Query:
318    def filter_vessel_name(self, eq: STR_PARAM = None,
319        min_val: OPT_STR = None, max_val: OPT_STR = None) -> 'Query':
320        """Filter on unique ID describing the vessel that made this observation.
321
322        Filter on unique ID describing the vessel that made this observation,
323        overwritting all prior vessel name filters on this Query.
324
325        Args:
326            eq: The exact value that must be matched for a record to be
327                returned. Pass None if no equality filter should be applied.
328                Error thrown if min_val or max_val also provided. May also be
329                a dictionary representing an ORDS query.
330            min_val: The minimum allowed value, inclusive. Pass None if no
331                minimum value filter should be applied. Defaults to None. Error
332                thrown if eq also proivded.
333            max_val: The maximum allowed value, inclusive. Pass None if no
334                maximum value filter should be applied. Defaults to None. Error
335                thrown if eq also proivded.
336
337        Returns:
338            This object for chaining if desired.
339        """
340        self._vessel_name = self._create_str_param(eq, min_val, max_val)
341        return self

Filter on unique ID describing the vessel that made this observation.

Filter on unique ID describing the vessel that made this observation, overwritting all prior vessel name filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_vessel_id( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None) -> Query:
343    def filter_vessel_id(self, eq: FLOAT_PARAM = None,
344        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None) -> 'Query':
345        """Filter on name of the vessel at the time the observation was made.
346
347        Filter on name of the vessel at the time the observation was made,
348        overwritting all prior vessel ID filters on this Query.
349
350        Args:
351            eq: The exact value that must be matched for a record to be
352                returned. Pass None if no equality filter should be applied.
353                Error thrown if min_val or max_val also provided. May also be
354                a dictionary representing an ORDS query.
355            min_val: The minimum allowed value, inclusive. Pass None if no
356                minimum value filter should be applied. Defaults to None. Error
357                thrown if eq also proivded.
358            max_val: The maximum allowed value, inclusive. Pass None if no
359                maximum value filter should be applied. Defaults to None. Error
360                thrown if eq also proivded.
361
362        Returns:
363            This object for chaining if desired.
364        """
365        self._vessel_id = self._create_float_param(eq, min_val, max_val)
366        return self

Filter on name of the vessel at the time the observation was made.

Filter on name of the vessel at the time the observation was made, overwritting all prior vessel ID filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_date_time( self, eq: Union[str, dict, NoneType] = None, min_val: Optional[str] = None, max_val: Optional[str] = None) -> Query:
368    def filter_date_time(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
369        max_val: OPT_STR = None) -> 'Query':
370        """Filter on the date and time of the haul.
371
372        Filter on the date and time of the haul as an ISO 8601 string. If given
373        an ISO 8601 string, will afscgap.convert from ISO 8601 to the API
374        datetime string format. Similarly, if given a dictionary, all values
375        matching an ISO 8601 string will be afscgap.converted to the API
376        datetime string format. Overwrites all prior date time filters on
377        this Query.
378
379        Args:
380            eq: The exact value that must be matched for a record to be
381                returned. Pass None if no equality filter should be applied.
382                Error thrown if min_val or max_val also provided. May also be
383                a dictionary representing an ORDS query.
384            min_val: The minimum allowed value, inclusive. Pass None if no
385                minimum value filter should be applied. Defaults to None. Error
386                thrown if eq also proivded.
387            max_val: The maximum allowed value, inclusive. Pass None if no
388                maximum value filter should be applied. Defaults to None. Error
389                thrown if eq also proivded.
390
391        Returns:
392            This object for chaining if desired.
393        """
394        self._date_time = self._create_str_param(eq, min_val, max_val)
395        return self

Filter on the date and time of the haul.

Filter on the date and time of the haul as an ISO 8601 string. If given an ISO 8601 string, will afscgap.convert from ISO 8601 to the API datetime string format. Similarly, if given a dictionary, all values matching an ISO 8601 string will be afscgap.converted to the API datetime string format. Overwrites all prior date time filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_latitude( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'dd') -> Query:
397    def filter_latitude(self, eq: FLOAT_PARAM = None,
398        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
399        units: str = 'dd') -> 'Query':
400        """Filter on latitude in decimal degrees associated with the haul.
401
402        Filter on latitude in decimal degrees associated with the haul,
403        overwritting all prior latitude filters on this Query.
404
405        Args:
406            eq: The exact value that must be matched for a record to be
407                returned. Pass None if no equality filter should be applied.
408                Error thrown if min_val or max_val also provided. May also be
409                a dictionary representing an ORDS query.
410            min_val: The minimum allowed value, inclusive. Pass None if no
411                minimum value filter should be applied. Defaults to None. Error
412                thrown if eq also proivded.
413            max_val: The maximum allowed value, inclusive. Pass None if no
414                maximum value filter should be applied. Defaults to None. Error
415                thrown if eq also proivded.
416            units: The units in which the filter values are provided. Currently
417                only dd supported. Ignored if given eq value containing ORDS
418                query.
419
420        Returns:
421            This object for chaining if desired.
422        """
423        self._latitude_dd = self._create_float_param(
424            afscgap.convert.unconvert_degrees(eq, units),
425            afscgap.convert.unconvert_degrees(min_val, units),
426            afscgap.convert.unconvert_degrees(max_val, units)
427        )
428        return self

Filter on latitude in decimal degrees associated with the haul.

Filter on latitude in decimal degrees associated with the haul, overwritting all prior latitude filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the filter values are provided. Currently only dd supported. Ignored if given eq value containing ORDS query.
Returns:

This object for chaining if desired.

def filter_longitude( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'dd') -> Query:
430    def filter_longitude(self, eq: FLOAT_PARAM = None,
431        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
432        units: str = 'dd') -> 'Query':
433        """Filter on longitude in decimal degrees associated with the haul.
434
435        Filter on longitude in decimal degrees associated with the haul,
436        overwritting all prior longitude filters on this Query.
437
438        Args:
439            eq: The exact value that must be matched for a record to be
440                returned. Pass None if no equality filter should be applied.
441                Error thrown if min_val or max_val also provided. May also be
442                a dictionary representing an ORDS query.
443            min_val: The minimum allowed value, inclusive. Pass None if no
444                minimum value filter should be applied. Defaults to None. Error
445                thrown if eq also proivded.
446            max_val: The maximum allowed value, inclusive. Pass None if no
447                maximum value filter should be applied. Defaults to None. Error
448                thrown if eq also proivded.
449            units: The units in which the filter values are provided. Currently
450                only dd supported.
451
452        Returns:
453            This object for chaining if desired.
454        """
455        self._longitude_dd = self._create_float_param(
456            afscgap.convert.unconvert_degrees(eq, units),
457            afscgap.convert.unconvert_degrees(min_val, units),
458            afscgap.convert.unconvert_degrees(max_val, units)
459        )
460        return self

Filter on longitude in decimal degrees associated with the haul.

Filter on longitude in decimal degrees associated with the haul, overwritting all prior longitude filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the filter values are provided. Currently only dd supported.
Returns:

This object for chaining if desired.

def filter_species_code( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None) -> Query:
462    def filter_species_code(self, eq: FLOAT_PARAM = None,
463        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None) -> 'Query':
464        """Filter on unique ID associated with the species observed.
465
466        Filter on unique ID associated with the species observed, overwritting
467        all prior species code filters on this Query.
468
469        Args:
470            eq: The exact value that must be matched for a record to be
471                returned. Pass None if no equality filter should be applied.
472                Error thrown if min_val or max_val also provided. May also be
473                a dictionary representing an ORDS query.
474            min_val: The minimum allowed value, inclusive. Pass None if no
475                minimum value filter should be applied. Defaults to None. Error
476                thrown if eq also proivded.
477            max_val: The maximum allowed value, inclusive. Pass None if no
478                maximum value filter should be applied. Defaults to None. Error
479                thrown if eq also proivded.
480
481        Returns:
482            This object for chaining if desired.
483        """
484        self._species_code = self._create_float_param(eq, min_val, max_val)
485        return self

Filter on unique ID associated with the species observed.

Filter on unique ID associated with the species observed, overwritting all prior species code filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_common_name( self, eq: Union[str, dict, NoneType] = None, min_val: Optional[str] = None, max_val: Optional[str] = None) -> Query:
487    def filter_common_name(self, eq: STR_PARAM = None, min_val: OPT_STR = None,
488        max_val: OPT_STR = None) -> 'Query':
489        """Filter on the "common name" associated with the species observed.
490
491        Filter on the "common name" associated with the species observed,
492        overwritting all prior common name filters on this Query.
493
494        Args:
495            eq: The exact value that must be matched for a record to be
496                returned. Pass None if no equality filter should be applied.
497                Error thrown if min_val or max_val also provided. May also be
498                a dictionary representing an ORDS query.
499            min_val: The minimum allowed value, inclusive. Pass None if no
500                minimum value filter should be applied. Defaults to None. Error
501                thrown if eq also proivded.
502            max_val: The maximum allowed value, inclusive. Pass None if no
503                maximum value filter should be applied. Defaults to None. Error
504                thrown if eq also proivded.
505
506        Returns:
507            This object for chaining if desired.
508        """
509        self._common_name = self._create_str_param(eq, min_val, max_val)
510        return self

Filter on the "common name" associated with the species observed.

Filter on the "common name" associated with the species observed, overwritting all prior common name filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_scientific_name( self, eq: Union[str, dict, NoneType] = None, min_val: Optional[str] = None, max_val: Optional[str] = None) -> Query:
512    def filter_scientific_name(self, eq: STR_PARAM = None,
513        min_val: OPT_STR = None, max_val: OPT_STR = None) -> 'Query':
514        """Filter on the "scientific name" associated with the species observed.
515
516        Filter on the "scientific name" associated with the species observed,
517        overwritting all prior scientific name filters on this Query.
518
519        Args:
520            eq: The exact value that must be matched for a record to be
521                returned. Pass None if no equality filter should be applied.
522                Error thrown if min_val or max_val also provided. May also be
523                a dictionary representing an ORDS query.
524            min_val: The minimum allowed value, inclusive. Pass None if no
525                minimum value filter should be applied. Defaults to None. Error
526                thrown if eq also proivded.
527            max_val: The maximum allowed value, inclusive. Pass None if no
528                maximum value filter should be applied. Defaults to None. Error
529                thrown if eq also proivded.
530
531        Returns:
532            This object for chaining if desired.
533        """
534        self._scientific_name = self._create_str_param(eq, min_val, max_val)
535        return self

Filter on the "scientific name" associated with the species observed.

Filter on the "scientific name" associated with the species observed, overwritting all prior scientific name filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_taxon_confidence( self, eq: Union[str, dict, NoneType] = None, min_val: Optional[str] = None, max_val: Optional[str] = None) -> Query:
537    def filter_taxon_confidence(self, eq: STR_PARAM = None,
538        min_val: OPT_STR = None, max_val: OPT_STR = None) -> 'Query':
539        """Filter on confidence flag regarding ability to identify species.
540
541        Filter on confidence flag regarding ability to identify species,
542        overwritting all taxon confidence filters on this Query.
543
544        Args:
545            eq: The exact value that must be matched for a record to be
546                returned. Pass None if no equality filter should be applied.
547                Error thrown if min_val or max_val also provided. May also be
548                a dictionary representing an ORDS query.
549            min_val: The minimum allowed value, inclusive. Pass None if no
550                minimum value filter should be applied. Defaults to None. Error
551                thrown if eq also proivded.
552            max_val: The maximum allowed value, inclusive. Pass None if no
553                maximum value filter should be applied. Defaults to None. Error
554                thrown if eq also proivded.
555
556        Returns:
557            This object for chaining if desired.
558        """
559        self._taxon_confidence = self._create_str_param(eq, min_val, max_val)
560        return self

Filter on confidence flag regarding ability to identify species.

Filter on confidence flag regarding ability to identify species, overwritting all taxon confidence filters on this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_cpue_weight( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'kg/ha') -> Query:
562    def filter_cpue_weight(self, eq: FLOAT_PARAM = None,
563        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
564        units: str = 'kg/ha') -> 'Query':
565        """Filter on catch per unit effort.
566
567        Filter on catch per unit effort as weight divided by net area if
568        available. Overwrites all prior CPUE weight filters applied to this
569        Query.
570
571        Args:
572            eq: The exact value that must be matched for a record to be
573                returned. Pass None if no equality filter should be applied.
574                Error thrown if min_val or max_val also provided. May also be
575                a dictionary representing an ORDS query.
576            min_val: The minimum allowed value, inclusive. Pass None if no
577                minimum value filter should be applied. Defaults to None. Error
578                thrown if eq also proivded.
579            max_val: The maximum allowed value, inclusive. Pass None if no
580                maximum value filter should be applied. Defaults to None. Error
581                thrown if eq also proivded.
582            units: The units for the catch per unit effort provided. Options:
583                kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha. Ignored if given
584                eq value containing ORDS query.
585
586        Returns:
587            This object for chaining if desired.
588        """
589        param = self._create_float_param(eq, min_val, max_val)
590
591        self._cpue_kgha = None
592        self._cpue_kgkm2 = None
593        self._cpue_kg1000km2 = None
594
595        if units == 'kg/ha':
596            self._cpue_kgha = param
597        elif units == 'kg/km2':
598            self._cpue_kgkm2 = param
599        elif units == 'kg1000/km2':
600            self._cpue_kg1000km2 = param
601        else:
602            raise RuntimeError('Unrecognized units ' + units)
603
604        return self

Filter on catch per unit effort.

Filter on catch per unit effort as weight divided by net area if available. Overwrites all prior CPUE weight filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units for the catch per unit effort provided. Options: kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha. Ignored if given eq value containing ORDS query.
Returns:

This object for chaining if desired.

def filter_cpue_count( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'count/ha') -> Query:
606    def filter_cpue_count(self, eq: FLOAT_PARAM = None,
607        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
608        units: str = 'count/ha') -> 'Query':
609        """Filter catch per unit effort as count over area in hectares.
610
611        Filter on catch number divided by net sweep area if available (count /
612        hectares). Overwrites all prior CPUE count filters applied to this
613        Query.
614
615        Args:
616            eq: The exact value that must be matched for a record to be
617                returned. Pass None if no equality filter should be applied.
618                Error thrown if min_val or max_val also provided. May also be
619                a dictionary representing an ORDS query.
620            min_val: The minimum allowed value, inclusive. Pass None if no
621                minimum value filter should be applied. Defaults to None. Error
622                thrown if eq also proivded.
623            max_val: The maximum allowed value, inclusive. Pass None if no
624                maximum value filter should be applied. Defaults to None. Error
625                thrown if eq also proivded.
626            units: The units for the given catch per unit effort. Options:
627                count/ha, count/km2, and count1000/km2. Defaults to count/ha.
628                Ignored if given eq value containing ORDS query.
629
630        Returns:
631            This object for chaining if desired.
632        """
633        param = self._create_float_param(eq, min_val, max_val)
634
635        self._cpue_noha = None
636        self._cpue_nokm2 = None
637        self._cpue_no1000km2 = None
638
639        if units == 'count/ha':
640            self._cpue_noha = param
641        elif units == 'count/km2':
642            self._cpue_nokm2 = param
643        elif units == 'count1000/km2':
644            self._cpue_no1000km2 = param
645        else:
646            raise RuntimeError('Unrecognized units ' + units)
647
648        return self

Filter catch per unit effort as count over area in hectares.

Filter on catch number divided by net sweep area if available (count / hectares). Overwrites all prior CPUE count filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units for the given catch per unit effort. Options: count/ha, count/km2, and count1000/km2. Defaults to count/ha. Ignored if given eq value containing ORDS query.
Returns:

This object for chaining if desired.

def filter_weight( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'kg') -> Query:
650    def filter_weight(self, eq: FLOAT_PARAM = None,
651        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
652        units: str = 'kg') -> 'Query':
653        """Filter on taxon weight (kg) if available.
654
655        Filter on taxon weight (kg) if available, overwrites all prior weight
656        filters applied to this Query.
657
658        Args:
659            eq: The exact value that must be matched for a record to be
660                returned. Pass None if no equality filter should be applied.
661                Error thrown if min_val or max_val also provided. May also be
662                a dictionary representing an ORDS query.
663            min_val: The minimum allowed value, inclusive. Pass None if no
664                minimum value filter should be applied. Defaults to None. Error
665                thrown if eq also proivded.
666            max_val: The maximum allowed value, inclusive. Pass None if no
667                maximum value filter should be applied. Defaults to None. Error
668                thrown if eq also proivded.
669            units: The units in which the weight are given. Options are
670                g, kg for grams and kilograms respectively. Deafults to kg.
671                Ignored if given eq value containing ORDS query.
672
673        Returns:
674            This object for chaining if desired.
675        """
676        self._weight_kg = self._create_float_param(
677            afscgap.convert.unconvert_weight(eq, units),
678            afscgap.convert.unconvert_weight(min_val, units),
679            afscgap.convert.unconvert_weight(max_val, units)
680        )
681        return self

Filter on taxon weight (kg) if available.

Filter on taxon weight (kg) if available, overwrites all prior weight filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the weight are given. Options are g, kg for grams and kilograms respectively. Deafults to kg. Ignored if given eq value containing ORDS query.
Returns:

This object for chaining if desired.

def filter_count( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None) -> Query:
683    def filter_count(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
684        max_val: OPT_FLOAT = None) -> 'Query':
685        """Filter on total number of organism individuals in haul.
686
687        Filter on total number of organism individuals in haul, overwrites all
688        prior count filters applied to this Query.
689
690        Args:
691            eq: The exact value that must be matched for a record to be
692                returned. Pass None if no equality filter should be applied.
693                Error thrown if min_val or max_val also provided. May also be
694                a dictionary representing an ORDS query.
695            min_val: The minimum allowed value, inclusive. Pass None if no
696                minimum value filter should be applied. Defaults to None. Error
697                thrown if eq also proivded.
698            max_val: The maximum allowed value, inclusive. Pass None if no
699                maximum value filter should be applied. Defaults to None. Error
700                thrown if eq also proivded. Ignored if given eq value containing
701                ORDS query.
702
703        Returns:
704            This object for chaining if desired.
705        """
706        self._count = self._create_float_param(eq, min_val, max_val)
707        return self

Filter on total number of organism individuals in haul.

Filter on total number of organism individuals in haul, overwrites all prior count filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded. Ignored if given eq value containing ORDS query.
Returns:

This object for chaining if desired.

def filter_bottom_temperature( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'c') -> Query:
709    def filter_bottom_temperature(self, eq: FLOAT_PARAM = None,
710        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
711        units: str = 'c') -> 'Query':
712        """Filter on bottom temperature.
713
714        Filter on bottom temperature associated with observation if available in
715        the units given. Overwrites all prior bottom temperature filters applied
716        to this Query.
717
718        Args:
719            eq: The exact value that must be matched for a record to be
720                returned. Pass None if no equality filter should be applied.
721                Error thrown if min_val or max_val also provided. May also be
722                a dictionary representing an ORDS query.
723            min_val: The minimum allowed value, inclusive. Pass None if no
724                minimum value filter should be applied. Defaults to None. Error
725                thrown if eq also proivded.
726            max_val: The maximum allowed value, inclusive. Pass None if no
727                maximum value filter should be applied. Defaults to None. Error
728                thrown if eq also proivded.
729            units: The units in which the temperature filter values are given.
730                Options: c or f for Celcius and Fahrenheit respectively.
731                Defaults to c. Ignored if given eq value containing ORDS query.
732
733        Returns:
734            This object for chaining if desired.
735        """
736        self._bottom_temperature_c = self._create_float_param(
737            afscgap.convert.unconvert_temperature(eq, units),
738            afscgap.convert.unconvert_temperature(min_val, units),
739            afscgap.convert.unconvert_temperature(max_val, units)
740        )
741        return self

Filter on bottom temperature.

Filter on bottom temperature associated with observation if available in the units given. Overwrites all prior bottom temperature filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the temperature filter values are given. Options: c or f for Celcius and Fahrenheit respectively. Defaults to c. Ignored if given eq value containing ORDS query.
Returns:

This object for chaining if desired.

def filter_surface_temperature( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'c') -> Query:
743    def filter_surface_temperature(self, eq: FLOAT_PARAM = None,
744        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
745        units: str = 'c') -> 'Query':
746        """Filter on surface temperature.
747
748        Filter on surface temperature associated with observation if available
749        in the units given. Overwrites all prior bottom temperature filters
750        applied to this Query.
751
752        Args:
753            eq: The exact value that must be matched for a record to be
754                returned. Pass None if no equality filter should be applied.
755                Error thrown if min_val or max_val also provided. May also be
756                a dictionary representing an ORDS query.
757            min_val: The minimum allowed value, inclusive. Pass None if no
758                minimum value filter should be applied. Defaults to None. Error
759                thrown if eq also proivded.
760            max_val: The maximum allowed value, inclusive. Pass None if no
761                maximum value filter should be applied. Defaults to None. Error
762                thrown if eq also proivded.
763            units: The units in which the temperature filter values are given.
764                Options: c or f for Celcius and Fahrenheit respectively.
765                Defaults to c. Ignored if given eq value containing ORDS query.
766
767        Returns:
768            This object for chaining if desired.
769        """
770        self._surface_temperature_c = self._create_float_param(
771            afscgap.convert.unconvert_temperature(eq, units),
772            afscgap.convert.unconvert_temperature(min_val, units),
773            afscgap.convert.unconvert_temperature(max_val, units)
774        )
775        return self

Filter on surface temperature.

Filter on surface temperature associated with observation if available in the units given. Overwrites all prior bottom temperature filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the temperature filter values are given. Options: c or f for Celcius and Fahrenheit respectively. Defaults to c. Ignored if given eq value containing ORDS query.
Returns:

This object for chaining if desired.

def filter_depth( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'm') -> Query:
777    def filter_depth(self, eq: FLOAT_PARAM = None, min_val: OPT_FLOAT = None,
778        max_val: OPT_FLOAT = None, units: str = 'm') -> 'Query':
779        """Filter on depth of the bottom in meters.
780
781        Filter on depth of the bottom in meters, overwrites all prior depth
782        filters applied to this Query.
783
784        Args:
785            eq: The exact value that must be matched for a record to be
786                returned. Pass None if no equality filter should be applied.
787                Error thrown if min_val or max_val also provided. May also be
788                a dictionary representing an ORDS query.
789            min_val: The minimum allowed value, inclusive. Pass None if no
790                minimum value filter should be applied. Defaults to None. Error
791                thrown if eq also proivded.
792            max_val: The maximum allowed value, inclusive. Pass None if no
793                maximum value filter should be applied. Defaults to None. Error
794                thrown if eq also proivded.
795            units: The units in which the distance are given. Options:
796                m or km for meters and kilometers respectively. Defaults to m.
797                Ignored if given eq value containing ORDS query.
798
799        Returns:
800            This object for chaining if desired.
801        """
802        self._depth_m = self._create_float_param(
803            afscgap.convert.unconvert_distance(eq, units),
804            afscgap.convert.unconvert_distance(min_val, units),
805            afscgap.convert.unconvert_distance(max_val, units)
806        )
807        return self

Filter on depth of the bottom in meters.

Filter on depth of the bottom in meters, overwrites all prior depth filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the distance are given. Options: m or km for meters and kilometers respectively. Defaults to m. Ignored if given eq value containing ORDS query.
Returns:

This object for chaining if desired.

def filter_distance_fished( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'm') -> Query:
809    def filter_distance_fished(self, eq: FLOAT_PARAM = None,
810        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
811        units: str = 'm') -> 'Query':
812        """Filter on distance of the net fished.
813
814        Filter on distance of the net fished, overwritting prior distance fished
815        filters applied to this Query.
816
817        Args:
818            eq: The exact value that must be matched for a record to be
819                returned. Pass None if no equality filter should be applied.
820                Error thrown if min_val or max_val also provided. May also be
821                a dictionary representing an ORDS query.
822            min_val: The minimum allowed value, inclusive. Pass None if no
823                minimum value filter should be applied. Defaults to None. Error
824                thrown if eq also proivded.
825            max_val: The maximum allowed value, inclusive. Pass None if no
826                maximum value filter should be applied. Defaults to None. Error
827                thrown if eq also proivded.
828            units: The units in which the distance values are given. Options:
829                m or km for meters and kilometers respectively. Defaults to m.
830                Ignored if given eq value containing ORDS query.
831
832        Returns:
833            This object for chaining if desired.
834        """
835        def convert_to_km(target, units):
836            in_meters = afscgap.convert.unconvert_distance(target, units)
837            return afscgap.convert.convert_distance(in_meters, 'km')
838
839        self._distance_fished_km = self._create_float_param(
840            convert_to_km(eq, units),
841            convert_to_km(min_val, units),
842            convert_to_km(max_val, units)
843        )
844        return self

Filter on distance of the net fished.

Filter on distance of the net fished, overwritting prior distance fished filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the distance values are given. Options: m or km for meters and kilometers respectively. Defaults to m. Ignored if given eq value containing ORDS query.
Returns:

This object for chaining if desired.

def filter_net_width( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'm') -> Query:
846    def filter_net_width(self, eq: FLOAT_PARAM = None,
847        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
848        units: str = 'm') -> 'Query':
849        """Filter on distance of the net fished.
850
851        Filter on distance of the net fished, overwritting prior net width
852        filters applied to this Query.
853
854        Args:
855            eq: The exact value that must be matched for a record to be
856                returned. Pass None if no equality filter should be applied.
857                Error thrown if min_val or max_val also provided. May also be
858                a dictionary representing an ORDS query.
859            min_val: The minimum allowed value, inclusive. Pass None if no
860                minimum value filter should be applied. Defaults to None. Error
861                thrown if eq also proivded.
862            max_val: The maximum allowed value, inclusive. Pass None if no
863                maximum value filter should be applied. Defaults to None. Error
864                thrown if eq also proivded.
865            units: The units in which the distance should be returned. Options:
866                m or km for meters and kilometers respectively. Defaults to m.
867
868        Returns:
869            This object for chaining if desired.
870        """
871        self._net_width_m = self._create_float_param(
872            afscgap.convert.unconvert_distance(eq, units),
873            afscgap.convert.unconvert_distance(min_val, units),
874            afscgap.convert.unconvert_distance(max_val, units)
875        )
876        return self

Filter on distance of the net fished.

Filter on distance of the net fished, overwritting prior net width filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the distance should be returned. Options: m or km for meters and kilometers respectively. Defaults to m.
Returns:

This object for chaining if desired.

def filter_net_height( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'm') -> Query:
878    def filter_net_height(self, eq: FLOAT_PARAM = None,
879        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
880        units: str = 'm') -> 'Query':
881        """Filter on height of the net fished.
882
883        Filter on height of the net fished, overwritting prior net height
884        filters applied to this Query.
885
886        Args:
887            eq: The exact value that must be matched for a record to be
888                returned. Pass None if no equality filter should be applied.
889                Error thrown if min_val or max_val also provided. May also be
890                a dictionary representing an ORDS query.
891            min_val: The minimum allowed value, inclusive. Pass None if no
892                minimum value filter should be applied. Defaults to None. Error
893                thrown if eq also proivded.
894            max_val: The maximum allowed value, inclusive. Pass None if no
895                maximum value filter should be applied. Defaults to None. Error
896                thrown if eq also proivded.
897            units: The units in which the distance should be returned. Options:
898                m or km for meters and kilometers respectively. Defaults to m.
899
900        Returns:
901            This object for chaining if desired.
902        """
903        self._net_height_m = self._create_float_param(
904            afscgap.convert.unconvert_distance(eq, units),
905            afscgap.convert.unconvert_distance(min_val, units),
906            afscgap.convert.unconvert_distance(max_val, units)
907        )
908        return self

Filter on height of the net fished.

Filter on height of the net fished, overwritting prior net height filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the distance should be returned. Options: m or km for meters and kilometers respectively. Defaults to m.
Returns:

This object for chaining if desired.

def filter_area_swept( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'm') -> Query:
910    def filter_area_swept(self, eq: FLOAT_PARAM = None,
911        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
912        units: str = 'm') -> 'Query':
913        """Filter on area covered by the net while fishing.
914
915        Filter on area covered by the net while fishing, overwritting prior
916        area swept filters applied to this Query.
917
918        Args:
919            eq: The exact value that must be matched for a record to be
920                returned. Pass None if no equality filter should be applied.
921                Error thrown if min_val or max_val also provided. May also be
922                a dictionary representing an ORDS query.
923            min_val: The minimum allowed value, inclusive. Pass None if no
924                minimum value filter should be applied. Defaults to None. Error
925                thrown if eq also proivded.
926            max_val: The maximum allowed value, inclusive. Pass None if no
927                maximum value filter should be applied. Defaults to None. Error
928                thrown if eq also proivded.
929            units: The units in which the area should be returned. Options:
930                ha, m2, km2. Defaults to ha.
931
932        Returns:
933            This object for chaining if desired.
934        """
935        self._area_swept_ha = self._create_float_param(
936            afscgap.convert.unconvert_area(eq, units),
937            afscgap.convert.unconvert_area(min_val, units),
938            afscgap.convert.unconvert_area(max_val, units)
939        )
940        return self

Filter on area covered by the net while fishing.

Filter on area covered by the net while fishing, overwritting prior area swept filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the area should be returned. Options: ha, m2, km2. Defaults to ha.
Returns:

This object for chaining if desired.

def filter_duration( self, eq: Union[float, dict, Tuple[float], NoneType] = None, min_val: Optional[float] = None, max_val: Optional[float] = None, units: str = 'hr') -> Query:
942    def filter_duration(self, eq: FLOAT_PARAM = None,
943        min_val: OPT_FLOAT = None, max_val: OPT_FLOAT = None,
944        units: str = 'hr') -> 'Query':
945        """Filter on duration of the haul.
946
947        Filter on duration of the haul, ovewritting all prior duration filters
948        applied to this Query.
949
950        Args:
951            eq: The exact value that must be matched for a record to be
952                returned. Pass None if no equality filter should be applied.
953                Error thrown if min_val or max_val also provided. May also be
954                a dictionary representing an ORDS query.
955            min_val: The minimum allowed value, inclusive. Pass None if no
956                minimum value filter should be applied. Defaults to None. Error
957                thrown if eq also proivded.
958            max_val: The maximum allowed value, inclusive. Pass None if no
959                maximum value filter should be applied. Defaults to None. Error
960                thrown if eq also proivded.
961            units: The units in which the duration should be returned. Options:
962                day, hr, min. Defaults to hr.
963
964        Returns:
965            This object for chaining if desired.
966        """
967        self._duration_hr = self._create_float_param(
968            afscgap.convert.unconvert_time(eq, units),
969            afscgap.convert.unconvert_time(min_val, units),
970            afscgap.convert.unconvert_time(max_val, units)
971        )
972        return self

Filter on duration of the haul.

Filter on duration of the haul, ovewritting all prior duration filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • units: The units in which the duration should be returned. Options: day, hr, min. Defaults to hr.
Returns:

This object for chaining if desired.

def filter_tsn( self, eq: Union[int, dict, Tuple[float], NoneType] = None, min_val: Optional[int] = None, max_val: Optional[int] = None) -> Query:
974    def filter_tsn(self, eq: INT_PARAM = None, min_val: OPT_INT = None,
975        max_val: OPT_INT = None) -> 'Query':
976        """Filter on taxonomic information system species code.
977
978        Filter on taxonomic information system species code, overwritting all
979        prior TSN filters applied to this Query.
980
981        Args:
982            eq: The exact value that must be matched for a record to be
983                returned. Pass None if no equality filter should be applied.
984                Error thrown if min_val or max_val also provided. May also be
985                a dictionary representing an ORDS query.
986            min_val: The minimum allowed value, inclusive. Pass None if no
987                minimum value filter should be applied. Defaults to None. Error
988                thrown if eq also proivded.
989            max_val: The maximum allowed value, inclusive. Pass None if no
990                maximum value filter should be applied. Defaults to None. Error
991                thrown if eq also proivded.
992
993        Returns:
994            This object for chaining if desired.
995        """
996        self._tsn = self._create_int_param(eq, min_val, max_val)
997        return self

Filter on taxonomic information system species code.

Filter on taxonomic information system species code, overwritting all prior TSN filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def filter_ak_survey_id( self, eq: Union[int, dict, Tuple[float], NoneType] = None, min_val: Optional[int] = None, max_val: Optional[int] = None) -> Query:
 999    def filter_ak_survey_id(self, eq: INT_PARAM = None, min_val: OPT_INT = None,
1000        max_val: OPT_INT = None) -> 'Query':
1001        """Filter on AK identifier for the survey.
1002
1003        Filter on AK identifier for the survey, overwritting all prior AK ID
1004        filters applied to this Query.
1005
1006        Args:
1007            eq: The exact value that must be matched for a record to be
1008                returned. Pass None if no equality filter should be applied.
1009                Error thrown if min_val or max_val also provided. May also be
1010                a dictionary representing an ORDS query.
1011            min_val: The minimum allowed value, inclusive. Pass None if no
1012                minimum value filter should be applied. Defaults to None. Error
1013                thrown if eq also proivded.
1014            max_val: The maximum allowed value, inclusive. Pass None if no
1015                maximum value filter should be applied. Defaults to None. Error
1016                thrown if eq also proivded.
1017
1018        Returns:
1019            This object for chaining if desired.
1020        """
1021        self._ak_survey_id = self._create_int_param(eq, min_val, max_val)
1022        return self

Filter on AK identifier for the survey.

Filter on AK identifier for the survey, overwritting all prior AK ID filters applied to this Query.

Arguments:
  • eq: The exact value that must be matched for a record to be returned. Pass None if no equality filter should be applied. Error thrown if min_val or max_val also provided. May also be a dictionary representing an ORDS query.
  • min_val: The minimum allowed value, inclusive. Pass None if no minimum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
  • max_val: The maximum allowed value, inclusive. Pass None if no maximum value filter should be applied. Defaults to None. Error thrown if eq also proivded.
Returns:

This object for chaining if desired.

def set_limit(self, limit: Optional[int]) -> Query:
1024    def set_limit(self, limit: OPT_INT) -> 'Query':
1025        """Set the max number of results.
1026
1027        Set the max number of results, overwritting prior limit settings on this
1028        Query.
1029
1030        Args:
1031            limit: The maximum number of results to retrieve per HTTP request.
1032                If None or not provided, will use API's default.
1033
1034        Returns:
1035            This object for chaining if desired.
1036        """
1037        self._limit = limit
1038        return self

Set the max number of results.

Set the max number of results, overwritting prior limit settings on this Query.

Arguments:
  • limit: The maximum number of results to retrieve per HTTP request. If None or not provided, will use API's default.
Returns:

This object for chaining if desired.

def set_start_offset(self, start_offset: Optional[int]) -> Query:
1040    def set_start_offset(self, start_offset: OPT_INT) -> 'Query':
1041        """Indicate how many results to skip.
1042
1043        Indicate how many results to skip, overwritting prior offset settings on
1044        this Query.
1045
1046        Args:
1047            start_offset: The number of initial results to skip in retrieving
1048                results. If None or not provided, none will be skipped.
1049
1050        Returns:
1051            This object for chaining if desired.
1052        """
1053        self._start_offset = start_offset
1054        return self

Indicate how many results to skip.

Indicate how many results to skip, overwritting prior offset settings on this Query.

Arguments:
  • start_offset: The number of initial results to skip in retrieving results. If None or not provided, none will be skipped.
Returns:

This object for chaining if desired.

def set_filter_incomplete(self, filter_incomplete: bool) -> Query:
1056    def set_filter_incomplete(self, filter_incomplete: bool) -> 'Query':
1057        """Indicate if incomplete records should be filtered out.
1058
1059        Indicate if incomplete records should be filtered out, overwritting
1060        prior incomplete filter settings on this Query.
1061
1062        Args:
1063            filter_incomplete: Flag indicating if "incomplete" records should be
1064                filtered. If true, "incomplete" records are silently filtered
1065                from the results, putting them in the invalid records queue. If
1066                false, they are included and their is_complete() will return
1067                false. Defaults to false.
1068
1069        Returns:
1070            This object for chaining if desired.
1071        """
1072        self._filter_incomplete = filter_incomplete
1073        return self

Indicate if incomplete records should be filtered out.

Indicate if incomplete records should be filtered out, overwritting prior incomplete filter settings on this Query.

Arguments:
  • filter_incomplete: Flag indicating if "incomplete" records should be filtered. If true, "incomplete" records are silently filtered from the results, putting them in the invalid records queue. If false, they are included and their is_complete() will return false. Defaults to false.
Returns:

This object for chaining if desired.

def set_presence_only(self, presence_only: bool) -> Query:
1075    def set_presence_only(self, presence_only: bool) -> 'Query':
1076        """Indicate if zero catch inference should be enabled.
1077
1078        Indicate if zero catch inference should be enabled, overwritting prior
1079        abscence / zero catch data settings on this Query.
1080
1081        Args:
1082            presence_only: Flag indicating if abscence / zero catch data should
1083                be inferred. If false, will run abscence data inference. If
1084                true, will return presence only data as returned by the NOAA API
1085                service. Defaults to true.
1086
1087        Returns:
1088            This object for chaining if desired.
1089        """
1090        self._presence_only = presence_only
1091        return self

Indicate if zero catch inference should be enabled.

Indicate if zero catch inference should be enabled, overwritting prior abscence / zero catch data settings on this Query.

Arguments:
  • presence_only: Flag indicating if abscence / zero catch data should be inferred. If false, will run abscence data inference. If true, will return presence only data as returned by the NOAA API service. Defaults to true.
Returns:

This object for chaining if desired.

def set_suppress_large_warning(self, supress: bool) -> Query:
1093    def set_suppress_large_warning(self, supress: bool) -> 'Query':
1094        """Indicate if the large results warning should be supressed.
1095
1096        Indicate if the large results warning should be supressed, overwritting
1097        prior large results warning supressions settings on this Query.
1098
1099        Args:
1100            suppress_large_warning: Indicate if the library should warn when an
1101                operation may consume a large amount of memory. If true, the
1102                warning will not be emitted. Defaults to true.
1103
1104        Returns:
1105            This object for chaining if desired.
1106        """
1107        self._suppress_large_warning = supress
1108        return self

Indicate if the large results warning should be supressed.

Indicate if the large results warning should be supressed, overwritting prior large results warning supressions settings on this Query.

Arguments:
  • suppress_large_warning: Indicate if the library should warn when an operation may consume a large amount of memory. If true, the warning will not be emitted. Defaults to true.
Returns:

This object for chaining if desired.

def set_warn_function( self, warn_function: Optional[Callable[[str], NoneType]]) -> Query:
1110    def set_warn_function(self, warn_function: WARN_FUNCTION) -> 'Query':
1111        """Indicate how warnings should be emitted.
1112
1113        Indicate how warnings should be emitted, overwritting the prior warning
1114        function settings on this Query.
1115
1116        Args:
1117            warn_function: Function to call with a message describing warnings
1118                encountered. If None, will use warnings.warn. Defaults to None.
1119
1120        Returns:
1121            This object for chaining if desired.
1122        """
1123        self._warn_function = warn_function
1124        return self

Indicate how warnings should be emitted.

Indicate how warnings should be emitted, overwritting the prior warning function settings on this Query.

Arguments:
  • warn_function: Function to call with a message describing warnings encountered. If None, will use warnings.warn. Defaults to None.
Returns:

This object for chaining if desired.

def set_hauls_prefetch( self, hauls_prefetch: Optional[List[afscgap.model.Haul]]) -> Query:
1126    def set_hauls_prefetch(self, hauls_prefetch: OPT_HAUL_LIST) -> 'Query':
1127        """Indicate if hauls' data were prefetched.
1128
1129        Indicate if hauls' data were prefetched, overwritting prior prefetch
1130        settings on this Query.
1131
1132        Args:
1133            hauls_prefetch: If using presence_only=True, this is ignored.
1134                Otherwise, if None, will instruct the library to download hauls
1135                metadata. If not None, will use this as the hauls list for zero
1136                catch record inference.
1137
1138        Returns:
1139            This object for chaining if desired.
1140        """
1141        self._hauls_prefetch = hauls_prefetch
1142        return self

Indicate if hauls' data were prefetched.

Indicate if hauls' data were prefetched, overwritting prior prefetch settings on this Query.

Arguments:
  • hauls_prefetch: If using presence_only=True, this is ignored. Otherwise, if None, will instruct the library to download hauls metadata. If not None, will use this as the hauls list for zero catch record inference.
Returns:

This object for chaining if desired.

def execute(self) -> afscgap.cursor.Cursor:
1144    def execute(self) -> afscgap.cursor.Cursor:
1145        """Execute the query built up in this object.
1146
1147        Execute the query built up in this object using its current state. Note
1148        that later changes to this builder will not impact prior returned
1149        Cursors from execute.
1150
1151        Returns:
1152            Cursor to manage HTTP requests and query results.
1153        """
1154        all_dict_raw = {
1155            'year': self._year,
1156            'srvy': self._srvy,
1157            'survey': self._survey,
1158            'survey_id': self._survey_id,
1159            'cruise': self._cruise,
1160            'haul': self._haul,
1161            'stratum': self._stratum,
1162            'station': self._station,
1163            'vessel_name': self._vessel_name,
1164            'vessel_id': self._vessel_id,
1165            'date_time': self._date_time,
1166            'latitude_dd': self._latitude_dd,
1167            'longitude_dd': self._longitude_dd,
1168            'species_code': self._species_code,
1169            'common_name': self._common_name,
1170            'scientific_name': self._scientific_name,
1171            'taxon_confidence': self._taxon_confidence,
1172            'cpue_kgha': self._cpue_kgha,
1173            'cpue_kgkm2': self._cpue_kgkm2,
1174            'cpue_kg1000km2': self._cpue_kg1000km2,
1175            'cpue_noha': self._cpue_noha,
1176            'cpue_nokm2': self._cpue_nokm2,
1177            'cpue_no1000km2': self._cpue_no1000km2,
1178            'weight_kg': self._weight_kg,
1179            'count': self._count,
1180            'bottom_temperature_c': self._bottom_temperature_c,
1181            'surface_temperature_c': self._surface_temperature_c,
1182            'depth_m': self._depth_m,
1183            'distance_fished_km': self._distance_fished_km,
1184            'net_width_m': self._net_width_m,
1185            'net_height_m': self._net_height_m,
1186            'area_swept_ha': self._area_swept_ha,
1187            'duration_hr': self._duration_hr,
1188            'tsn': self._tsn,
1189            'ak_survey_id': self._ak_survey_id
1190        }
1191
1192        api_cursor = afscgap.client.build_api_cursor(
1193            all_dict_raw,
1194            limit=self._limit,
1195            start_offset=self._start_offset,
1196            filter_incomplete=self._filter_incomplete,
1197            requestor=self._requestor,
1198            base_url=self._base_url
1199        )
1200
1201        if self._presence_only:
1202            return api_cursor
1203
1204        decorated_cursor = afscgap.inference.build_inference_cursor(
1205            all_dict_raw,
1206            api_cursor,
1207            requestor=self._requestor,
1208            hauls_url=self._hauls_url,
1209            hauls_prefetch=self._hauls_prefetch
1210        )
1211
1212        if not self._suppress_large_warning:
1213            warn_function = self._warn_function
1214            if not warn_function:
1215                warn_function = lambda x: warnings.warn(x)
1216
1217            warn_function(LARGE_WARNING)
1218
1219        return decorated_cursor

Execute the query built up in this object.

Execute the query built up in this object using its current state. Note that later changes to this builder will not impact prior returned Cursors from execute.

Returns:

Cursor to manage HTTP requests and query results.