afscgap.model

Definition of common library data with its structures and interfaces.

(c) 2025 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"""
  2Definition of common library data with its structures and interfaces.
  3
  4(c) 2025 Regents of University of California / The Eric and Wendy Schmidt Center
  5for Data Science and the Environment at UC Berkeley.
  6
  7This file is part of afscgap released under the BSD 3-Clause License. See
  8LICENSE.md.
  9"""
 10from afscgap.typesdef import OPT_FLOAT
 11from afscgap.typesdef import OPT_STR
 12
 13OPT_RECORD = 'typing.Optional[Record]'
 14
 15
 16class Record:
 17    """Interface describing a single record.
 18
 19    Interface describing a single record of an observtion. Note that, in
 20    practice, this "observation" can be a presence obervation where a species
 21    was found or an "absence" / "zero catch" observation where a sepcies was
 22    not observed in a haul.
 23    """
 24
 25    def get_year(self) -> float:
 26        """Get the field labeled as year in the API.
 27
 28        Returns:
 29            Year for the survey in which this observation was made or for which
 30            an inferred zero catch record was generated.
 31        """
 32        raise NotImplementedError('Use implementor.')
 33
 34    def get_srvy(self) -> str:
 35        """Get the field labeled as srvy in the API.
 36
 37        Returns:
 38            The name of the survey in which this observation or inference was
 39            made. NBS (N Bearing Sea), EBS (SE Bearing Sea), BSS (Bearing Sea
 40            Slope), or GOA (Gulf of Alaska)
 41        """
 42        raise NotImplementedError('Use implementor.')
 43
 44    def get_survey(self) -> str:
 45        """Get the field labeled as survey in the API.
 46
 47        Returns:
 48            Long form description of the survey in which the observation was
 49            made or for which an inferred zero catch record was made.
 50        """
 51        raise NotImplementedError('Use implementor.')
 52
 53    def get_survey_id(self) -> float:
 54        """Get the field labeled as survey_id in the API.
 55
 56        Returns:
 57            Unique numeric ID for the survey.
 58        """
 59        raise NotImplementedError('Use implementor.')
 60
 61    def get_cruise(self) -> float:
 62        """Get the field labeled as cruise in the API.
 63
 64        Returns:
 65            An ID uniquely identifying the cruise in which the observation or
 66            inferrence was made. Multiple cruises in a survey.
 67        """
 68        raise NotImplementedError('Use implementor.')
 69
 70    def get_haul(self) -> float:
 71        """Get the field labeled as haul in the API.
 72
 73        Returns:
 74            An ID uniquely identifying the haul in which this observation or
 75            inference was made. Multiple hauls per cruises.
 76        """
 77        raise NotImplementedError('Use implementor.')
 78
 79    def get_stratum(self) -> float:
 80        """Get the field labeled as stratum in the API.
 81
 82        Returns:
 83            Unique ID for statistical area / survey combination as described in
 84            the metadata or 0 if an experimental tow.
 85        """
 86        raise NotImplementedError('Use implementor.')
 87
 88    def get_station(self) -> str:
 89        """Get the field labeled as station in the API.
 90
 91        Returns:
 92            Station associated with the survey.
 93        """
 94        raise NotImplementedError('Use implementor.')
 95
 96    def get_vessel_name(self) -> str:
 97        """Get the field labeled as vessel_name in the API.
 98
 99        Returns:
100            Unique ID describing the vessel that made this observation or
101            inference.
102        """
103        raise NotImplementedError('Use implementor.')
104
105    def get_vessel_id(self) -> float:
106        """Get the field labeled as vessel_id in the API.
107
108        Returns:
109            Name of the vessel at the time the observation was made with
110            multiple names potentially associated with a vessel ID. May be
111            emulated in the case of inferred records
112        """
113        raise NotImplementedError('Use implementor.')
114
115    def get_date_time(self) -> str:
116        """Get the field labeled as date_time in the API.
117
118        Returns:
119            The date and time of the haul which has been attempted to be
120            transformed to an ISO 8601 string without timezone info. If it
121            couldn’t be transformed, the original string is reported.
122        """
123        raise NotImplementedError('Use implementor.')
124
125    def get_latitude_start(self, units: str = 'dd') -> float:
126        """Get the field labeled as latitude_dd_start in the API.
127
128        Args:
129            units: The units to return this value in. Only supported is dd for
130                degrees. Deafults to dd.
131
132        Returns:
133            Latitude in decimal degrees associated with the haul.
134        """
135        raise NotImplementedError('Use implementor.')
136
137    def get_longitude_start(self, units: str = 'dd') -> float:
138        """Get the field labeled as longitude_dd_start in the API.
139
140        Args:
141            units: The units to return this value in. Only supported is dd for
142                degrees. Deafults to dd.
143
144        Returns:
145            Longitude in decimal degrees associated with the haul.
146        """
147        raise NotImplementedError('Use implementor.')
148
149    def get_latitude(self, units: str = 'dd') -> float:
150        """Get midpoint of the haul, approximating deprecated latitude_dd field in the API.
151
152        Args:
153            units: The units to return this value in. Only supported is dd for
154                degrees. Deafults to dd.
155
156        Returns:
157            Latitude in decimal degrees associated with the haul.
158        """
159        raise NotImplementedError('Use implementor.')
160
161    def get_longitude(self, units: str = 'dd') -> float:
162        """Get midpoint of the haul, approximating deprecated longitude_dd field in the API.
163
164        Args:
165            units: The units to return this value in. Only supported is dd for
166                degrees. Deafults to dd.
167
168        Returns:
169            Longitude in decimal degrees associated with the haul.
170        """
171        raise NotImplementedError('Use implementor.')
172
173    def get_latitude_end(self, units: str = 'dd') -> float:
174        """Get the field labeled as latitude_dd_end in the API.
175
176        Args:
177            units: The units to return this value in. Only supported is dd for
178                degrees. Deafults to dd.
179
180        Returns:
181            Latitude in decimal degrees associated with the haul.
182        """
183        raise NotImplementedError('Use implementor.')
184
185    def get_longitude_end(self, units: str = 'dd') -> float:
186        """Get the field labeled as longitude_dd_end in the API.
187
188        Args:
189            units: The units to return this value in. Only supported is dd for
190                degrees. Deafults to dd.
191
192        Returns:
193            Longitude in decimal degrees associated with the haul.
194        """
195        raise NotImplementedError('Use implementor.')
196
197    def get_species_code(self) -> OPT_FLOAT:
198        """Get the field labeled as species_code in the API.
199
200        Returns:
201            Unique ID associated with the species observed or for which a zero
202            catch record was inferred.
203        """
204        raise NotImplementedError('Use implementor.')
205
206    def get_common_name(self) -> OPT_STR:
207        """Get the field labeled as common_name in the API.
208
209        Returns:
210            The “common name” associated with the species observed or for which
211            a zero catch record was inferred. Example: Pacific glass shrimp.
212        """
213        raise NotImplementedError('Use implementor.')
214
215    def get_scientific_name(self) -> OPT_STR:
216        """Get the field labeled as scientific_name in the API.
217
218        Returns:
219            The “scientific name” associated with the species observed or for
220            which a zero catch record was inferred. Example: Pasiphaea pacifica.
221        """
222        raise NotImplementedError('Use implementor.')
223
224    def get_taxon_confidence(self) -> OPT_STR:
225        """Get the field labeled as taxon_confidence in the API.
226
227        Returns:
228            Confidence flag regarding ability to identify species (High,
229            Moderate, Low). In practice, this can also be Unassessed.
230        """
231        raise NotImplementedError('Use implementor.')
232
233    def get_cpue_weight_maybe(self, units: str = 'kg/ha') -> OPT_FLOAT:
234        """Get a field labeled as cpue_* in the API.
235
236        Args:
237            units: The desired units for the catch per unit effort. Options:
238                kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha.
239
240        Returns:
241            Catch weight divided by net area (in given units) if available. See
242            metadata. None if could not interpret as a float. If an inferred
243            zero catch record, will be zero.
244        """
245        raise NotImplementedError('Use implementor.')
246
247    def get_cpue_count_maybe(self, units: str = 'count/ha') -> OPT_FLOAT:
248        """Get the field labeled as cpue_* in the API.
249
250        Get the catch per unit effort from the record with one of the following
251        units: kg/ha, kg/km2, kg1000/km2.
252
253        Args:
254            units: The desired units for the catch per unit effort. Options:
255                count/ha, count/km2, and count1000/km2. Defaults to count/ha.
256
257        Returns:
258            Catch weight divided by net area (in given units) if available. See
259            metadata. None if could not interpret as a float. If an inferred
260            zero catch record, will be zero.
261        """
262        raise NotImplementedError('Use implementor.')
263
264    def get_weight_maybe(self, units: str = 'kg') -> OPT_FLOAT:
265        """Get the field labeled as weight_kg in the API.
266
267        Args:
268            units: The units in which the weight should be returned. Options are
269                g, kg for grams and kilograms respectively. Deafults to kg.
270
271        Returns:
272            Taxon weight if available. See metadata. None if could not
273            interpret as a float. If an inferred zero catch record, will be
274            zero.
275        """
276        raise NotImplementedError('Use implementor.')
277
278    def get_count_maybe(self) -> OPT_FLOAT:
279        """Get the field labeled as count in the API.
280
281        Returns:
282            Total number of organism individuals in haul. None if could not
283            interpret as a float. If an inferred zero catch record, will be
284            zero.
285        """
286        raise NotImplementedError('Use implementor.')
287
288    def get_bottom_temperature_maybe(self, units: str = 'c') -> OPT_FLOAT:
289        """Get the field labeled as bottom_temperature_c in the API.
290
291        Args:
292            units: The units in which the temperature should be returned.
293                Options: c or f for Celcius and Fahrenheit respectively.
294                Defaults to c.
295
296        Returns:
297            Bottom temperature associated with observation / inferrence if
298            available in desired units. None if not given or could not interpret
299            as a float.
300        """
301        raise NotImplementedError('Use implementor.')
302
303    def get_surface_temperature_maybe(self, units: str = 'c') -> OPT_FLOAT:
304        """Get the field labeled as surface_temperature_c in the API.
305
306        Args:
307            units: The units in which the temperature should be returned.
308                Options: c or f for Celcius and Fahrenheit respectively.
309                Defaults to c.
310
311        Returns:
312            Surface temperature associated with observation / inferrence if
313            available. None if not given or could not interpret as a float.
314        """
315        raise NotImplementedError('Use implementor.')
316
317    def get_depth(self, units: str = 'm') -> float:
318        """Get the field labeled as depth_m in the API.
319
320        Args:
321            units: The units in which the distance should be returned. Options:
322                m or km for meters and kilometers respectively. Defaults to m.
323
324        Returns:
325            Depth of the bottom.
326        """
327        raise NotImplementedError('Use implementor.')
328
329    def get_distance_fished(self, units: str = 'm') -> float:
330        """Get the field labeled as distance_fished_km in the API.
331
332        Args:
333            units: The units in which the distance should be returned. Options:
334                m or km for meters and kilometers respectively. Defaults to m.
335
336        Returns:
337            Distance of the net fished.
338        """
339        raise NotImplementedError('Use implementor.')
340
341    def get_net_width(self, units: str = 'm') -> float:
342        """Get the field labeled as net_width_m in the API.
343
344        Args:
345            units: The units in which the distance should be returned. Options:
346                m or km for meters and kilometers respectively. Defaults to m.
347
348        Returns:
349            Distance of the net fished after asserting it is given.
350        """
351        raise NotImplementedError('Use implementor.')
352
353    def get_net_height(self, units: str = 'm') -> float:
354        """Get the field labeled as net_height_m in the API.
355
356        Args:
357            units: The units in which the distance should be returned. Options:
358                m or km for meters and kilometers respectively. Defaults to m.
359
360        Returns:
361            Height of the net fished after asserting it is given.
362        """
363        raise NotImplementedError('Use implementor.')
364
365    def get_net_width_maybe(self, units: str = 'm') -> OPT_FLOAT:
366        """Get the field labeled as net_width_m in the API.
367
368        Args:
369            units: The units in which the distance should be returned. Options:
370                m or km for meters and kilometers respectively. Defaults to m.
371
372        Returns:
373            Distance of the net fished or None if not given.
374        """
375        raise NotImplementedError('Use implementor.')
376
377    def get_net_height_maybe(self, units: str = 'm') -> OPT_FLOAT:
378        """Get the field labeled as net_height_m in the API.
379
380        Args:
381            units: The units in which the distance should be returned. Options:
382                m or km for meters and kilometers respectively. Defaults to m.
383
384        Returns:
385            Height of the net fished or None if not given.
386        """
387        raise NotImplementedError('Use implementor.')
388
389    def get_area_swept(self, units: str = 'ha') -> float:
390        """Get the field labeled as area_swept_ha in the API.
391
392        Args:
393            units: The units in which the area should be returned. Options:
394                ha, m2, km2. Defaults to ha.
395
396        Returns:
397            Area covered by the net while fishing in desired units.
398        """
399        raise NotImplementedError('Use implementor.')
400
401    def get_duration(self, units: str = 'hr') -> float:
402        """Get the field labeled as duration_hr in the API.
403
404        Args:
405            units: The units in which the duration should be returned. Options:
406                day, hr, min. Defaults to hr.
407
408        Returns:
409            Duration of the haul.
410        """
411        raise NotImplementedError('Use implementor.')
412
413    def get_cpue_weight(self, units: str = 'kg/ha') -> float:
414        """Get the value of field cpue_kgha with validity assert.
415
416        Args:
417            units: The desired units for the catch per unit effort. Options:
418                kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha.
419
420        Raises:
421            AssertionError: Raised if this field was not given by the API or
422            could not be parsed as expected.
423
424        Returns:
425            Catch weight divided by net area (kg / hectares) if available. See
426            metadata. Will be zero if a zero catch record.
427        """
428        raise NotImplementedError('Use implementor.')
429
430    def get_cpue_count(self, units: str = 'count/ha') -> float:
431        """Get the value of field cpue_noha with validity assert.
432
433        Args:
434            units: The desired units for the catch per unit effort. Options:
435                count/ha, count/km2, and count1000/km2. Defaults to count/ha.
436
437        Raises:
438            AssertionError: Raised if this field was not given by the API or
439            could not be parsed as expected.
440
441        Returns:
442            Catch number divided by net sweep area if available (count /
443            hectares). See metadata. Will be zero if a zero catch record.
444        """
445        raise NotImplementedError('Use implementor.')
446
447    def get_weight(self, units: str = 'kg') -> float:
448        """Get the value of field weight_kg with validity assert.
449
450        Args:
451            units: The units in which the weight should be returned. Options are
452                g, kg for grams and kilograms respectively. Deafults to kg.
453
454        Raises:
455            AssertionError: Raised if this field was not given by the API or
456            could not be parsed as expected.
457
458        Returns:
459            Taxon weight (kg) if available. See metadata. Will be zero if a zero
460            catch record.
461        """
462        raise NotImplementedError('Use implementor.')
463
464    def get_count(self) -> float:
465        """Get the value of field count with validity assert.
466
467        Raises:
468            AssertionError: Raised if this field was not given by the API or
469            could not be parsed as expected.
470
471        Returns:
472            Total number of organism individuals in haul. Will be zero if a zero
473            catch record.
474        """
475        raise NotImplementedError('Use implementor.')
476
477    def get_bottom_temperature(self, units='c') -> float:
478        """Get the value of field bottom_temperature_c with validity assert.
479
480        Args:
481            units: The units in which the temperature should be returned.
482                Options: c or f for Celcius and Fahrenheit respectively.
483                Defaults to c.
484
485        Raises:
486            AssertionError: Raised if this field was not given by the API or
487            could not be parsed as expected.
488
489        Returns:
490            Bottom temperature associated with observation / inferrence if
491            available.
492        """
493        raise NotImplementedError('Use implementor.')
494
495    def get_surface_temperature(self, units='c') -> float:
496        """Get the value of field surface_temperature_c with validity assert.
497
498        Args:
499            units: The units in which the temperature should be returned.
500                Options: c or f for Celcius and Fahrenheit respectively.
501                Defaults to c.
502
503        Raises:
504            AssertionError: Raised if this field was not given by the API or
505            could not be parsed as expected.
506
507        Returns:
508            Surface temperature associated with observation / inferrence if
509            available.
510        """
511        raise NotImplementedError('Use implementor.')
512
513    def is_complete(self) -> bool:
514        """Determine if this record has all of its values filled in.
515
516        Returns:
517            True if all optional fields have a parsed value with the expected
518            type and false otherwise.
519        """
520        raise NotImplementedError('Use implementor.')
521
522    def to_dict(self) -> dict:
523        """Serialize this Record to a dictionary form.
524
525        Serialize this Record to a dictionary form, including only field names
526        that would be found on records returned from the API service.
527
528        Returns:
529            Dictionary with field names matching those found in the API results
530            with incomplete records having some values as None.
531        """
532        return {
533            'year': self.get_year(),
534            'srvy': self.get_srvy(),
535            'survey': self.get_survey(),
536            'survey_id': self.get_survey_id(),
537            'cruise': self.get_cruise(),
538            'haul': self.get_haul(),
539            'stratum': self.get_stratum(),
540            'station': self.get_station(),
541            'vessel_name': self.get_vessel_name(),
542            'vessel_id': self.get_vessel_id(),
543            'date_time': self.get_date_time(),
544            'latitude_dd': self.get_latitude(),
545            'longitude_dd': self.get_longitude(),
546            'species_code': self.get_species_code(),
547            'common_name': self.get_common_name(),
548            'scientific_name': self.get_scientific_name(),
549            'taxon_confidence': self.get_taxon_confidence(),
550            'cpue_kgha': self.get_cpue_weight_maybe(units='kg/ha'),
551            'cpue_kgkm2': self.get_cpue_weight_maybe(units='kg/km2'),
552            'cpue_kg1000km2': self.get_cpue_weight_maybe(units='kg1000/km2'),
553            'cpue_noha': self.get_cpue_count_maybe(units='count/ha'),
554            'cpue_nokm2': self.get_cpue_count_maybe(units='count/km2'),
555            'cpue_no1000km2': self.get_cpue_count_maybe(units='count1000/km2'),
556            'weight_kg': self.get_weight(units='kg'),
557            'count': self.get_count(),
558            'bottom_temperature_c': self.get_bottom_temperature_maybe(
559                units='c'
560            ),
561            'surface_temperature_c': self.get_surface_temperature_maybe(
562                units='c'
563            ),
564            'depth_m': self.get_depth(units='m'),
565            'distance_fished_km': self.get_distance_fished(units='km'),
566            'net_width_m': self.get_net_width(units='m'),
567            'net_height_m': self.get_net_height(units='m'),
568            'area_swept_ha': self.get_area_swept(units='ha'),
569            'duration_hr': self.get_duration(units='hr')
570        }
OPT_RECORD = 'typing.Optional[Record]'
class Record:
 17class Record:
 18    """Interface describing a single record.
 19
 20    Interface describing a single record of an observtion. Note that, in
 21    practice, this "observation" can be a presence obervation where a species
 22    was found or an "absence" / "zero catch" observation where a sepcies was
 23    not observed in a haul.
 24    """
 25
 26    def get_year(self) -> float:
 27        """Get the field labeled as year in the API.
 28
 29        Returns:
 30            Year for the survey in which this observation was made or for which
 31            an inferred zero catch record was generated.
 32        """
 33        raise NotImplementedError('Use implementor.')
 34
 35    def get_srvy(self) -> str:
 36        """Get the field labeled as srvy in the API.
 37
 38        Returns:
 39            The name of the survey in which this observation or inference was
 40            made. NBS (N Bearing Sea), EBS (SE Bearing Sea), BSS (Bearing Sea
 41            Slope), or GOA (Gulf of Alaska)
 42        """
 43        raise NotImplementedError('Use implementor.')
 44
 45    def get_survey(self) -> str:
 46        """Get the field labeled as survey in the API.
 47
 48        Returns:
 49            Long form description of the survey in which the observation was
 50            made or for which an inferred zero catch record was made.
 51        """
 52        raise NotImplementedError('Use implementor.')
 53
 54    def get_survey_id(self) -> float:
 55        """Get the field labeled as survey_id in the API.
 56
 57        Returns:
 58            Unique numeric ID for the survey.
 59        """
 60        raise NotImplementedError('Use implementor.')
 61
 62    def get_cruise(self) -> float:
 63        """Get the field labeled as cruise in the API.
 64
 65        Returns:
 66            An ID uniquely identifying the cruise in which the observation or
 67            inferrence was made. Multiple cruises in a survey.
 68        """
 69        raise NotImplementedError('Use implementor.')
 70
 71    def get_haul(self) -> float:
 72        """Get the field labeled as haul in the API.
 73
 74        Returns:
 75            An ID uniquely identifying the haul in which this observation or
 76            inference was made. Multiple hauls per cruises.
 77        """
 78        raise NotImplementedError('Use implementor.')
 79
 80    def get_stratum(self) -> float:
 81        """Get the field labeled as stratum in the API.
 82
 83        Returns:
 84            Unique ID for statistical area / survey combination as described in
 85            the metadata or 0 if an experimental tow.
 86        """
 87        raise NotImplementedError('Use implementor.')
 88
 89    def get_station(self) -> str:
 90        """Get the field labeled as station in the API.
 91
 92        Returns:
 93            Station associated with the survey.
 94        """
 95        raise NotImplementedError('Use implementor.')
 96
 97    def get_vessel_name(self) -> str:
 98        """Get the field labeled as vessel_name in the API.
 99
100        Returns:
101            Unique ID describing the vessel that made this observation or
102            inference.
103        """
104        raise NotImplementedError('Use implementor.')
105
106    def get_vessel_id(self) -> float:
107        """Get the field labeled as vessel_id in the API.
108
109        Returns:
110            Name of the vessel at the time the observation was made with
111            multiple names potentially associated with a vessel ID. May be
112            emulated in the case of inferred records
113        """
114        raise NotImplementedError('Use implementor.')
115
116    def get_date_time(self) -> str:
117        """Get the field labeled as date_time in the API.
118
119        Returns:
120            The date and time of the haul which has been attempted to be
121            transformed to an ISO 8601 string without timezone info. If it
122            couldn’t be transformed, the original string is reported.
123        """
124        raise NotImplementedError('Use implementor.')
125
126    def get_latitude_start(self, units: str = 'dd') -> float:
127        """Get the field labeled as latitude_dd_start in the API.
128
129        Args:
130            units: The units to return this value in. Only supported is dd for
131                degrees. Deafults to dd.
132
133        Returns:
134            Latitude in decimal degrees associated with the haul.
135        """
136        raise NotImplementedError('Use implementor.')
137
138    def get_longitude_start(self, units: str = 'dd') -> float:
139        """Get the field labeled as longitude_dd_start in the API.
140
141        Args:
142            units: The units to return this value in. Only supported is dd for
143                degrees. Deafults to dd.
144
145        Returns:
146            Longitude in decimal degrees associated with the haul.
147        """
148        raise NotImplementedError('Use implementor.')
149
150    def get_latitude(self, units: str = 'dd') -> float:
151        """Get midpoint of the haul, approximating deprecated latitude_dd field in the API.
152
153        Args:
154            units: The units to return this value in. Only supported is dd for
155                degrees. Deafults to dd.
156
157        Returns:
158            Latitude in decimal degrees associated with the haul.
159        """
160        raise NotImplementedError('Use implementor.')
161
162    def get_longitude(self, units: str = 'dd') -> float:
163        """Get midpoint of the haul, approximating deprecated longitude_dd field in the API.
164
165        Args:
166            units: The units to return this value in. Only supported is dd for
167                degrees. Deafults to dd.
168
169        Returns:
170            Longitude in decimal degrees associated with the haul.
171        """
172        raise NotImplementedError('Use implementor.')
173
174    def get_latitude_end(self, units: str = 'dd') -> float:
175        """Get the field labeled as latitude_dd_end in the API.
176
177        Args:
178            units: The units to return this value in. Only supported is dd for
179                degrees. Deafults to dd.
180
181        Returns:
182            Latitude in decimal degrees associated with the haul.
183        """
184        raise NotImplementedError('Use implementor.')
185
186    def get_longitude_end(self, units: str = 'dd') -> float:
187        """Get the field labeled as longitude_dd_end in the API.
188
189        Args:
190            units: The units to return this value in. Only supported is dd for
191                degrees. Deafults to dd.
192
193        Returns:
194            Longitude in decimal degrees associated with the haul.
195        """
196        raise NotImplementedError('Use implementor.')
197
198    def get_species_code(self) -> OPT_FLOAT:
199        """Get the field labeled as species_code in the API.
200
201        Returns:
202            Unique ID associated with the species observed or for which a zero
203            catch record was inferred.
204        """
205        raise NotImplementedError('Use implementor.')
206
207    def get_common_name(self) -> OPT_STR:
208        """Get the field labeled as common_name in the API.
209
210        Returns:
211            The “common name” associated with the species observed or for which
212            a zero catch record was inferred. Example: Pacific glass shrimp.
213        """
214        raise NotImplementedError('Use implementor.')
215
216    def get_scientific_name(self) -> OPT_STR:
217        """Get the field labeled as scientific_name in the API.
218
219        Returns:
220            The “scientific name” associated with the species observed or for
221            which a zero catch record was inferred. Example: Pasiphaea pacifica.
222        """
223        raise NotImplementedError('Use implementor.')
224
225    def get_taxon_confidence(self) -> OPT_STR:
226        """Get the field labeled as taxon_confidence in the API.
227
228        Returns:
229            Confidence flag regarding ability to identify species (High,
230            Moderate, Low). In practice, this can also be Unassessed.
231        """
232        raise NotImplementedError('Use implementor.')
233
234    def get_cpue_weight_maybe(self, units: str = 'kg/ha') -> OPT_FLOAT:
235        """Get a field labeled as cpue_* in the API.
236
237        Args:
238            units: The desired units for the catch per unit effort. Options:
239                kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha.
240
241        Returns:
242            Catch weight divided by net area (in given units) if available. See
243            metadata. None if could not interpret as a float. If an inferred
244            zero catch record, will be zero.
245        """
246        raise NotImplementedError('Use implementor.')
247
248    def get_cpue_count_maybe(self, units: str = 'count/ha') -> OPT_FLOAT:
249        """Get the field labeled as cpue_* in the API.
250
251        Get the catch per unit effort from the record with one of the following
252        units: kg/ha, kg/km2, kg1000/km2.
253
254        Args:
255            units: The desired units for the catch per unit effort. Options:
256                count/ha, count/km2, and count1000/km2. Defaults to count/ha.
257
258        Returns:
259            Catch weight divided by net area (in given units) if available. See
260            metadata. None if could not interpret as a float. If an inferred
261            zero catch record, will be zero.
262        """
263        raise NotImplementedError('Use implementor.')
264
265    def get_weight_maybe(self, units: str = 'kg') -> OPT_FLOAT:
266        """Get the field labeled as weight_kg in the API.
267
268        Args:
269            units: The units in which the weight should be returned. Options are
270                g, kg for grams and kilograms respectively. Deafults to kg.
271
272        Returns:
273            Taxon weight if available. See metadata. None if could not
274            interpret as a float. If an inferred zero catch record, will be
275            zero.
276        """
277        raise NotImplementedError('Use implementor.')
278
279    def get_count_maybe(self) -> OPT_FLOAT:
280        """Get the field labeled as count in the API.
281
282        Returns:
283            Total number of organism individuals in haul. None if could not
284            interpret as a float. If an inferred zero catch record, will be
285            zero.
286        """
287        raise NotImplementedError('Use implementor.')
288
289    def get_bottom_temperature_maybe(self, units: str = 'c') -> OPT_FLOAT:
290        """Get the field labeled as bottom_temperature_c in the API.
291
292        Args:
293            units: The units in which the temperature should be returned.
294                Options: c or f for Celcius and Fahrenheit respectively.
295                Defaults to c.
296
297        Returns:
298            Bottom temperature associated with observation / inferrence if
299            available in desired units. None if not given or could not interpret
300            as a float.
301        """
302        raise NotImplementedError('Use implementor.')
303
304    def get_surface_temperature_maybe(self, units: str = 'c') -> OPT_FLOAT:
305        """Get the field labeled as surface_temperature_c in the API.
306
307        Args:
308            units: The units in which the temperature should be returned.
309                Options: c or f for Celcius and Fahrenheit respectively.
310                Defaults to c.
311
312        Returns:
313            Surface temperature associated with observation / inferrence if
314            available. None if not given or could not interpret as a float.
315        """
316        raise NotImplementedError('Use implementor.')
317
318    def get_depth(self, units: str = 'm') -> float:
319        """Get the field labeled as depth_m in the API.
320
321        Args:
322            units: The units in which the distance should be returned. Options:
323                m or km for meters and kilometers respectively. Defaults to m.
324
325        Returns:
326            Depth of the bottom.
327        """
328        raise NotImplementedError('Use implementor.')
329
330    def get_distance_fished(self, units: str = 'm') -> float:
331        """Get the field labeled as distance_fished_km in the API.
332
333        Args:
334            units: The units in which the distance should be returned. Options:
335                m or km for meters and kilometers respectively. Defaults to m.
336
337        Returns:
338            Distance of the net fished.
339        """
340        raise NotImplementedError('Use implementor.')
341
342    def get_net_width(self, units: str = 'm') -> float:
343        """Get the field labeled as net_width_m in the API.
344
345        Args:
346            units: The units in which the distance should be returned. Options:
347                m or km for meters and kilometers respectively. Defaults to m.
348
349        Returns:
350            Distance of the net fished after asserting it is given.
351        """
352        raise NotImplementedError('Use implementor.')
353
354    def get_net_height(self, units: str = 'm') -> float:
355        """Get the field labeled as net_height_m in the API.
356
357        Args:
358            units: The units in which the distance should be returned. Options:
359                m or km for meters and kilometers respectively. Defaults to m.
360
361        Returns:
362            Height of the net fished after asserting it is given.
363        """
364        raise NotImplementedError('Use implementor.')
365
366    def get_net_width_maybe(self, units: str = 'm') -> OPT_FLOAT:
367        """Get the field labeled as net_width_m in the API.
368
369        Args:
370            units: The units in which the distance should be returned. Options:
371                m or km for meters and kilometers respectively. Defaults to m.
372
373        Returns:
374            Distance of the net fished or None if not given.
375        """
376        raise NotImplementedError('Use implementor.')
377
378    def get_net_height_maybe(self, units: str = 'm') -> OPT_FLOAT:
379        """Get the field labeled as net_height_m in the API.
380
381        Args:
382            units: The units in which the distance should be returned. Options:
383                m or km for meters and kilometers respectively. Defaults to m.
384
385        Returns:
386            Height of the net fished or None if not given.
387        """
388        raise NotImplementedError('Use implementor.')
389
390    def get_area_swept(self, units: str = 'ha') -> float:
391        """Get the field labeled as area_swept_ha in the API.
392
393        Args:
394            units: The units in which the area should be returned. Options:
395                ha, m2, km2. Defaults to ha.
396
397        Returns:
398            Area covered by the net while fishing in desired units.
399        """
400        raise NotImplementedError('Use implementor.')
401
402    def get_duration(self, units: str = 'hr') -> float:
403        """Get the field labeled as duration_hr in the API.
404
405        Args:
406            units: The units in which the duration should be returned. Options:
407                day, hr, min. Defaults to hr.
408
409        Returns:
410            Duration of the haul.
411        """
412        raise NotImplementedError('Use implementor.')
413
414    def get_cpue_weight(self, units: str = 'kg/ha') -> float:
415        """Get the value of field cpue_kgha with validity assert.
416
417        Args:
418            units: The desired units for the catch per unit effort. Options:
419                kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha.
420
421        Raises:
422            AssertionError: Raised if this field was not given by the API or
423            could not be parsed as expected.
424
425        Returns:
426            Catch weight divided by net area (kg / hectares) if available. See
427            metadata. Will be zero if a zero catch record.
428        """
429        raise NotImplementedError('Use implementor.')
430
431    def get_cpue_count(self, units: str = 'count/ha') -> float:
432        """Get the value of field cpue_noha with validity assert.
433
434        Args:
435            units: The desired units for the catch per unit effort. Options:
436                count/ha, count/km2, and count1000/km2. Defaults to count/ha.
437
438        Raises:
439            AssertionError: Raised if this field was not given by the API or
440            could not be parsed as expected.
441
442        Returns:
443            Catch number divided by net sweep area if available (count /
444            hectares). See metadata. Will be zero if a zero catch record.
445        """
446        raise NotImplementedError('Use implementor.')
447
448    def get_weight(self, units: str = 'kg') -> float:
449        """Get the value of field weight_kg with validity assert.
450
451        Args:
452            units: The units in which the weight should be returned. Options are
453                g, kg for grams and kilograms respectively. Deafults to kg.
454
455        Raises:
456            AssertionError: Raised if this field was not given by the API or
457            could not be parsed as expected.
458
459        Returns:
460            Taxon weight (kg) if available. See metadata. Will be zero if a zero
461            catch record.
462        """
463        raise NotImplementedError('Use implementor.')
464
465    def get_count(self) -> float:
466        """Get the value of field count with validity assert.
467
468        Raises:
469            AssertionError: Raised if this field was not given by the API or
470            could not be parsed as expected.
471
472        Returns:
473            Total number of organism individuals in haul. Will be zero if a zero
474            catch record.
475        """
476        raise NotImplementedError('Use implementor.')
477
478    def get_bottom_temperature(self, units='c') -> float:
479        """Get the value of field bottom_temperature_c with validity assert.
480
481        Args:
482            units: The units in which the temperature should be returned.
483                Options: c or f for Celcius and Fahrenheit respectively.
484                Defaults to c.
485
486        Raises:
487            AssertionError: Raised if this field was not given by the API or
488            could not be parsed as expected.
489
490        Returns:
491            Bottom temperature associated with observation / inferrence if
492            available.
493        """
494        raise NotImplementedError('Use implementor.')
495
496    def get_surface_temperature(self, units='c') -> float:
497        """Get the value of field surface_temperature_c with validity assert.
498
499        Args:
500            units: The units in which the temperature should be returned.
501                Options: c or f for Celcius and Fahrenheit respectively.
502                Defaults to c.
503
504        Raises:
505            AssertionError: Raised if this field was not given by the API or
506            could not be parsed as expected.
507
508        Returns:
509            Surface temperature associated with observation / inferrence if
510            available.
511        """
512        raise NotImplementedError('Use implementor.')
513
514    def is_complete(self) -> bool:
515        """Determine if this record has all of its values filled in.
516
517        Returns:
518            True if all optional fields have a parsed value with the expected
519            type and false otherwise.
520        """
521        raise NotImplementedError('Use implementor.')
522
523    def to_dict(self) -> dict:
524        """Serialize this Record to a dictionary form.
525
526        Serialize this Record to a dictionary form, including only field names
527        that would be found on records returned from the API service.
528
529        Returns:
530            Dictionary with field names matching those found in the API results
531            with incomplete records having some values as None.
532        """
533        return {
534            'year': self.get_year(),
535            'srvy': self.get_srvy(),
536            'survey': self.get_survey(),
537            'survey_id': self.get_survey_id(),
538            'cruise': self.get_cruise(),
539            'haul': self.get_haul(),
540            'stratum': self.get_stratum(),
541            'station': self.get_station(),
542            'vessel_name': self.get_vessel_name(),
543            'vessel_id': self.get_vessel_id(),
544            'date_time': self.get_date_time(),
545            'latitude_dd': self.get_latitude(),
546            'longitude_dd': self.get_longitude(),
547            'species_code': self.get_species_code(),
548            'common_name': self.get_common_name(),
549            'scientific_name': self.get_scientific_name(),
550            'taxon_confidence': self.get_taxon_confidence(),
551            'cpue_kgha': self.get_cpue_weight_maybe(units='kg/ha'),
552            'cpue_kgkm2': self.get_cpue_weight_maybe(units='kg/km2'),
553            'cpue_kg1000km2': self.get_cpue_weight_maybe(units='kg1000/km2'),
554            'cpue_noha': self.get_cpue_count_maybe(units='count/ha'),
555            'cpue_nokm2': self.get_cpue_count_maybe(units='count/km2'),
556            'cpue_no1000km2': self.get_cpue_count_maybe(units='count1000/km2'),
557            'weight_kg': self.get_weight(units='kg'),
558            'count': self.get_count(),
559            'bottom_temperature_c': self.get_bottom_temperature_maybe(
560                units='c'
561            ),
562            'surface_temperature_c': self.get_surface_temperature_maybe(
563                units='c'
564            ),
565            'depth_m': self.get_depth(units='m'),
566            'distance_fished_km': self.get_distance_fished(units='km'),
567            'net_width_m': self.get_net_width(units='m'),
568            'net_height_m': self.get_net_height(units='m'),
569            'area_swept_ha': self.get_area_swept(units='ha'),
570            'duration_hr': self.get_duration(units='hr')
571        }

Interface describing a single record.

Interface describing a single record of an observtion. Note that, in practice, this "observation" can be a presence obervation where a species was found or an "absence" / "zero catch" observation where a sepcies was not observed in a haul.

def get_year(self) -> float:
26    def get_year(self) -> float:
27        """Get the field labeled as year in the API.
28
29        Returns:
30            Year for the survey in which this observation was made or for which
31            an inferred zero catch record was generated.
32        """
33        raise NotImplementedError('Use implementor.')

Get the field labeled as year in the API.

Returns:

Year for the survey in which this observation was made or for which an inferred zero catch record was generated.

def get_srvy(self) -> str:
35    def get_srvy(self) -> str:
36        """Get the field labeled as srvy in the API.
37
38        Returns:
39            The name of the survey in which this observation or inference was
40            made. NBS (N Bearing Sea), EBS (SE Bearing Sea), BSS (Bearing Sea
41            Slope), or GOA (Gulf of Alaska)
42        """
43        raise NotImplementedError('Use implementor.')

Get the field labeled as srvy in the API.

Returns:

The name of the survey in which this observation or inference was made. NBS (N Bearing Sea), EBS (SE Bearing Sea), BSS (Bearing Sea Slope), or GOA (Gulf of Alaska)

def get_survey(self) -> str:
45    def get_survey(self) -> str:
46        """Get the field labeled as survey in the API.
47
48        Returns:
49            Long form description of the survey in which the observation was
50            made or for which an inferred zero catch record was made.
51        """
52        raise NotImplementedError('Use implementor.')

Get the field labeled as survey in the API.

Returns:

Long form description of the survey in which the observation was made or for which an inferred zero catch record was made.

def get_survey_id(self) -> float:
54    def get_survey_id(self) -> float:
55        """Get the field labeled as survey_id in the API.
56
57        Returns:
58            Unique numeric ID for the survey.
59        """
60        raise NotImplementedError('Use implementor.')

Get the field labeled as survey_id in the API.

Returns:

Unique numeric ID for the survey.

def get_cruise(self) -> float:
62    def get_cruise(self) -> float:
63        """Get the field labeled as cruise in the API.
64
65        Returns:
66            An ID uniquely identifying the cruise in which the observation or
67            inferrence was made. Multiple cruises in a survey.
68        """
69        raise NotImplementedError('Use implementor.')

Get the field labeled as cruise in the API.

Returns:

An ID uniquely identifying the cruise in which the observation or inferrence was made. Multiple cruises in a survey.

def get_haul(self) -> float:
71    def get_haul(self) -> float:
72        """Get the field labeled as haul in the API.
73
74        Returns:
75            An ID uniquely identifying the haul in which this observation or
76            inference was made. Multiple hauls per cruises.
77        """
78        raise NotImplementedError('Use implementor.')

Get the field labeled as haul in the API.

Returns:

An ID uniquely identifying the haul in which this observation or inference was made. Multiple hauls per cruises.

def get_stratum(self) -> float:
80    def get_stratum(self) -> float:
81        """Get the field labeled as stratum in the API.
82
83        Returns:
84            Unique ID for statistical area / survey combination as described in
85            the metadata or 0 if an experimental tow.
86        """
87        raise NotImplementedError('Use implementor.')

Get the field labeled as stratum in the API.

Returns:

Unique ID for statistical area / survey combination as described in the metadata or 0 if an experimental tow.

def get_station(self) -> str:
89    def get_station(self) -> str:
90        """Get the field labeled as station in the API.
91
92        Returns:
93            Station associated with the survey.
94        """
95        raise NotImplementedError('Use implementor.')

Get the field labeled as station in the API.

Returns:

Station associated with the survey.

def get_vessel_name(self) -> str:
 97    def get_vessel_name(self) -> str:
 98        """Get the field labeled as vessel_name in the API.
 99
100        Returns:
101            Unique ID describing the vessel that made this observation or
102            inference.
103        """
104        raise NotImplementedError('Use implementor.')

Get the field labeled as vessel_name in the API.

Returns:

Unique ID describing the vessel that made this observation or inference.

def get_vessel_id(self) -> float:
106    def get_vessel_id(self) -> float:
107        """Get the field labeled as vessel_id in the API.
108
109        Returns:
110            Name of the vessel at the time the observation was made with
111            multiple names potentially associated with a vessel ID. May be
112            emulated in the case of inferred records
113        """
114        raise NotImplementedError('Use implementor.')

Get the field labeled as vessel_id in the API.

Returns:

Name of the vessel at the time the observation was made with multiple names potentially associated with a vessel ID. May be emulated in the case of inferred records

def get_date_time(self) -> str:
116    def get_date_time(self) -> str:
117        """Get the field labeled as date_time in the API.
118
119        Returns:
120            The date and time of the haul which has been attempted to be
121            transformed to an ISO 8601 string without timezone info. If it
122            couldn’t be transformed, the original string is reported.
123        """
124        raise NotImplementedError('Use implementor.')

Get the field labeled as date_time in the API.

Returns:

The date and time of the haul which has been attempted to be transformed to an ISO 8601 string without timezone info. If it couldn’t be transformed, the original string is reported.

def get_latitude_start(self, units: str = 'dd') -> float:
126    def get_latitude_start(self, units: str = 'dd') -> float:
127        """Get the field labeled as latitude_dd_start in the API.
128
129        Args:
130            units: The units to return this value in. Only supported is dd for
131                degrees. Deafults to dd.
132
133        Returns:
134            Latitude in decimal degrees associated with the haul.
135        """
136        raise NotImplementedError('Use implementor.')

Get the field labeled as latitude_dd_start in the API.

Arguments:
  • units: The units to return this value in. Only supported is dd for degrees. Deafults to dd.
Returns:

Latitude in decimal degrees associated with the haul.

def get_longitude_start(self, units: str = 'dd') -> float:
138    def get_longitude_start(self, units: str = 'dd') -> float:
139        """Get the field labeled as longitude_dd_start in the API.
140
141        Args:
142            units: The units to return this value in. Only supported is dd for
143                degrees. Deafults to dd.
144
145        Returns:
146            Longitude in decimal degrees associated with the haul.
147        """
148        raise NotImplementedError('Use implementor.')

Get the field labeled as longitude_dd_start in the API.

Arguments:
  • units: The units to return this value in. Only supported is dd for degrees. Deafults to dd.
Returns:

Longitude in decimal degrees associated with the haul.

def get_latitude(self, units: str = 'dd') -> float:
150    def get_latitude(self, units: str = 'dd') -> float:
151        """Get midpoint of the haul, approximating deprecated latitude_dd field in the API.
152
153        Args:
154            units: The units to return this value in. Only supported is dd for
155                degrees. Deafults to dd.
156
157        Returns:
158            Latitude in decimal degrees associated with the haul.
159        """
160        raise NotImplementedError('Use implementor.')

Get midpoint of the haul, approximating deprecated latitude_dd field in the API.

Arguments:
  • units: The units to return this value in. Only supported is dd for degrees. Deafults to dd.
Returns:

Latitude in decimal degrees associated with the haul.

def get_longitude(self, units: str = 'dd') -> float:
162    def get_longitude(self, units: str = 'dd') -> float:
163        """Get midpoint of the haul, approximating deprecated longitude_dd field in the API.
164
165        Args:
166            units: The units to return this value in. Only supported is dd for
167                degrees. Deafults to dd.
168
169        Returns:
170            Longitude in decimal degrees associated with the haul.
171        """
172        raise NotImplementedError('Use implementor.')

Get midpoint of the haul, approximating deprecated longitude_dd field in the API.

Arguments:
  • units: The units to return this value in. Only supported is dd for degrees. Deafults to dd.
Returns:

Longitude in decimal degrees associated with the haul.

def get_latitude_end(self, units: str = 'dd') -> float:
174    def get_latitude_end(self, units: str = 'dd') -> float:
175        """Get the field labeled as latitude_dd_end in the API.
176
177        Args:
178            units: The units to return this value in. Only supported is dd for
179                degrees. Deafults to dd.
180
181        Returns:
182            Latitude in decimal degrees associated with the haul.
183        """
184        raise NotImplementedError('Use implementor.')

Get the field labeled as latitude_dd_end in the API.

Arguments:
  • units: The units to return this value in. Only supported is dd for degrees. Deafults to dd.
Returns:

Latitude in decimal degrees associated with the haul.

def get_longitude_end(self, units: str = 'dd') -> float:
186    def get_longitude_end(self, units: str = 'dd') -> float:
187        """Get the field labeled as longitude_dd_end in the API.
188
189        Args:
190            units: The units to return this value in. Only supported is dd for
191                degrees. Deafults to dd.
192
193        Returns:
194            Longitude in decimal degrees associated with the haul.
195        """
196        raise NotImplementedError('Use implementor.')

Get the field labeled as longitude_dd_end in the API.

Arguments:
  • units: The units to return this value in. Only supported is dd for degrees. Deafults to dd.
Returns:

Longitude in decimal degrees associated with the haul.

def get_species_code(self) -> Optional[float]:
198    def get_species_code(self) -> OPT_FLOAT:
199        """Get the field labeled as species_code in the API.
200
201        Returns:
202            Unique ID associated with the species observed or for which a zero
203            catch record was inferred.
204        """
205        raise NotImplementedError('Use implementor.')

Get the field labeled as species_code in the API.

Returns:

Unique ID associated with the species observed or for which a zero catch record was inferred.

def get_common_name(self) -> Optional[str]:
207    def get_common_name(self) -> OPT_STR:
208        """Get the field labeled as common_name in the API.
209
210        Returns:
211            The “common name” associated with the species observed or for which
212            a zero catch record was inferred. Example: Pacific glass shrimp.
213        """
214        raise NotImplementedError('Use implementor.')

Get the field labeled as common_name in the API.

Returns:

The “common name” associated with the species observed or for which a zero catch record was inferred. Example: Pacific glass shrimp.

def get_scientific_name(self) -> Optional[str]:
216    def get_scientific_name(self) -> OPT_STR:
217        """Get the field labeled as scientific_name in the API.
218
219        Returns:
220            The “scientific name” associated with the species observed or for
221            which a zero catch record was inferred. Example: Pasiphaea pacifica.
222        """
223        raise NotImplementedError('Use implementor.')

Get the field labeled as scientific_name in the API.

Returns:

The “scientific name” associated with the species observed or for which a zero catch record was inferred. Example: Pasiphaea pacifica.

def get_taxon_confidence(self) -> Optional[str]:
225    def get_taxon_confidence(self) -> OPT_STR:
226        """Get the field labeled as taxon_confidence in the API.
227
228        Returns:
229            Confidence flag regarding ability to identify species (High,
230            Moderate, Low). In practice, this can also be Unassessed.
231        """
232        raise NotImplementedError('Use implementor.')

Get the field labeled as taxon_confidence in the API.

Returns:

Confidence flag regarding ability to identify species (High, Moderate, Low). In practice, this can also be Unassessed.

def get_cpue_weight_maybe(self, units: str = 'kg/ha') -> Optional[float]:
234    def get_cpue_weight_maybe(self, units: str = 'kg/ha') -> OPT_FLOAT:
235        """Get a field labeled as cpue_* in the API.
236
237        Args:
238            units: The desired units for the catch per unit effort. Options:
239                kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha.
240
241        Returns:
242            Catch weight divided by net area (in given units) if available. See
243            metadata. None if could not interpret as a float. If an inferred
244            zero catch record, will be zero.
245        """
246        raise NotImplementedError('Use implementor.')

Get a field labeled as cpue_* in the API.

Arguments:
  • units: The desired units for the catch per unit effort. Options: kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha.
Returns:

Catch weight divided by net area (in given units) if available. See metadata. None if could not interpret as a float. If an inferred zero catch record, will be zero.

def get_cpue_count_maybe(self, units: str = 'count/ha') -> Optional[float]:
248    def get_cpue_count_maybe(self, units: str = 'count/ha') -> OPT_FLOAT:
249        """Get the field labeled as cpue_* in the API.
250
251        Get the catch per unit effort from the record with one of the following
252        units: kg/ha, kg/km2, kg1000/km2.
253
254        Args:
255            units: The desired units for the catch per unit effort. Options:
256                count/ha, count/km2, and count1000/km2. Defaults to count/ha.
257
258        Returns:
259            Catch weight divided by net area (in given units) if available. See
260            metadata. None if could not interpret as a float. If an inferred
261            zero catch record, will be zero.
262        """
263        raise NotImplementedError('Use implementor.')

Get the field labeled as cpue_* in the API.

Get the catch per unit effort from the record with one of the following units: kg/ha, kg/km2, kg1000/km2.

Arguments:
  • units: The desired units for the catch per unit effort. Options: count/ha, count/km2, and count1000/km2. Defaults to count/ha.
Returns:

Catch weight divided by net area (in given units) if available. See metadata. None if could not interpret as a float. If an inferred zero catch record, will be zero.

def get_weight_maybe(self, units: str = 'kg') -> Optional[float]:
265    def get_weight_maybe(self, units: str = 'kg') -> OPT_FLOAT:
266        """Get the field labeled as weight_kg in the API.
267
268        Args:
269            units: The units in which the weight should be returned. Options are
270                g, kg for grams and kilograms respectively. Deafults to kg.
271
272        Returns:
273            Taxon weight if available. See metadata. None if could not
274            interpret as a float. If an inferred zero catch record, will be
275            zero.
276        """
277        raise NotImplementedError('Use implementor.')

Get the field labeled as weight_kg in the API.

Arguments:
  • units: The units in which the weight should be returned. Options are g, kg for grams and kilograms respectively. Deafults to kg.
Returns:

Taxon weight if available. See metadata. None if could not interpret as a float. If an inferred zero catch record, will be zero.

def get_count_maybe(self) -> Optional[float]:
279    def get_count_maybe(self) -> OPT_FLOAT:
280        """Get the field labeled as count in the API.
281
282        Returns:
283            Total number of organism individuals in haul. None if could not
284            interpret as a float. If an inferred zero catch record, will be
285            zero.
286        """
287        raise NotImplementedError('Use implementor.')

Get the field labeled as count in the API.

Returns:

Total number of organism individuals in haul. None if could not interpret as a float. If an inferred zero catch record, will be zero.

def get_bottom_temperature_maybe(self, units: str = 'c') -> Optional[float]:
289    def get_bottom_temperature_maybe(self, units: str = 'c') -> OPT_FLOAT:
290        """Get the field labeled as bottom_temperature_c in the API.
291
292        Args:
293            units: The units in which the temperature should be returned.
294                Options: c or f for Celcius and Fahrenheit respectively.
295                Defaults to c.
296
297        Returns:
298            Bottom temperature associated with observation / inferrence if
299            available in desired units. None if not given or could not interpret
300            as a float.
301        """
302        raise NotImplementedError('Use implementor.')

Get the field labeled as bottom_temperature_c in the API.

Arguments:
  • units: The units in which the temperature should be returned. Options: c or f for Celcius and Fahrenheit respectively. Defaults to c.
Returns:

Bottom temperature associated with observation / inferrence if available in desired units. None if not given or could not interpret as a float.

def get_surface_temperature_maybe(self, units: str = 'c') -> Optional[float]:
304    def get_surface_temperature_maybe(self, units: str = 'c') -> OPT_FLOAT:
305        """Get the field labeled as surface_temperature_c in the API.
306
307        Args:
308            units: The units in which the temperature should be returned.
309                Options: c or f for Celcius and Fahrenheit respectively.
310                Defaults to c.
311
312        Returns:
313            Surface temperature associated with observation / inferrence if
314            available. None if not given or could not interpret as a float.
315        """
316        raise NotImplementedError('Use implementor.')

Get the field labeled as surface_temperature_c in the API.

Arguments:
  • units: The units in which the temperature should be returned. Options: c or f for Celcius and Fahrenheit respectively. Defaults to c.
Returns:

Surface temperature associated with observation / inferrence if available. None if not given or could not interpret as a float.

def get_depth(self, units: str = 'm') -> float:
318    def get_depth(self, units: str = 'm') -> float:
319        """Get the field labeled as depth_m in the API.
320
321        Args:
322            units: The units in which the distance should be returned. Options:
323                m or km for meters and kilometers respectively. Defaults to m.
324
325        Returns:
326            Depth of the bottom.
327        """
328        raise NotImplementedError('Use implementor.')

Get the field labeled as depth_m in the API.

Arguments:
  • units: The units in which the distance should be returned. Options: m or km for meters and kilometers respectively. Defaults to m.
Returns:

Depth of the bottom.

def get_distance_fished(self, units: str = 'm') -> float:
330    def get_distance_fished(self, units: str = 'm') -> float:
331        """Get the field labeled as distance_fished_km in the API.
332
333        Args:
334            units: The units in which the distance should be returned. Options:
335                m or km for meters and kilometers respectively. Defaults to m.
336
337        Returns:
338            Distance of the net fished.
339        """
340        raise NotImplementedError('Use implementor.')

Get the field labeled as distance_fished_km in the API.

Arguments:
  • units: The units in which the distance should be returned. Options: m or km for meters and kilometers respectively. Defaults to m.
Returns:

Distance of the net fished.

def get_net_width(self, units: str = 'm') -> float:
342    def get_net_width(self, units: str = 'm') -> float:
343        """Get the field labeled as net_width_m in the API.
344
345        Args:
346            units: The units in which the distance should be returned. Options:
347                m or km for meters and kilometers respectively. Defaults to m.
348
349        Returns:
350            Distance of the net fished after asserting it is given.
351        """
352        raise NotImplementedError('Use implementor.')

Get the field labeled as net_width_m in the API.

Arguments:
  • units: The units in which the distance should be returned. Options: m or km for meters and kilometers respectively. Defaults to m.
Returns:

Distance of the net fished after asserting it is given.

def get_net_height(self, units: str = 'm') -> float:
354    def get_net_height(self, units: str = 'm') -> float:
355        """Get the field labeled as net_height_m in the API.
356
357        Args:
358            units: The units in which the distance should be returned. Options:
359                m or km for meters and kilometers respectively. Defaults to m.
360
361        Returns:
362            Height of the net fished after asserting it is given.
363        """
364        raise NotImplementedError('Use implementor.')

Get the field labeled as net_height_m in the API.

Arguments:
  • units: The units in which the distance should be returned. Options: m or km for meters and kilometers respectively. Defaults to m.
Returns:

Height of the net fished after asserting it is given.

def get_net_width_maybe(self, units: str = 'm') -> Optional[float]:
366    def get_net_width_maybe(self, units: str = 'm') -> OPT_FLOAT:
367        """Get the field labeled as net_width_m in the API.
368
369        Args:
370            units: The units in which the distance should be returned. Options:
371                m or km for meters and kilometers respectively. Defaults to m.
372
373        Returns:
374            Distance of the net fished or None if not given.
375        """
376        raise NotImplementedError('Use implementor.')

Get the field labeled as net_width_m in the API.

Arguments:
  • units: The units in which the distance should be returned. Options: m or km for meters and kilometers respectively. Defaults to m.
Returns:

Distance of the net fished or None if not given.

def get_net_height_maybe(self, units: str = 'm') -> Optional[float]:
378    def get_net_height_maybe(self, units: str = 'm') -> OPT_FLOAT:
379        """Get the field labeled as net_height_m in the API.
380
381        Args:
382            units: The units in which the distance should be returned. Options:
383                m or km for meters and kilometers respectively. Defaults to m.
384
385        Returns:
386            Height of the net fished or None if not given.
387        """
388        raise NotImplementedError('Use implementor.')

Get the field labeled as net_height_m in the API.

Arguments:
  • units: The units in which the distance should be returned. Options: m or km for meters and kilometers respectively. Defaults to m.
Returns:

Height of the net fished or None if not given.

def get_area_swept(self, units: str = 'ha') -> float:
390    def get_area_swept(self, units: str = 'ha') -> float:
391        """Get the field labeled as area_swept_ha in the API.
392
393        Args:
394            units: The units in which the area should be returned. Options:
395                ha, m2, km2. Defaults to ha.
396
397        Returns:
398            Area covered by the net while fishing in desired units.
399        """
400        raise NotImplementedError('Use implementor.')

Get the field labeled as area_swept_ha in the API.

Arguments:
  • units: The units in which the area should be returned. Options: ha, m2, km2. Defaults to ha.
Returns:

Area covered by the net while fishing in desired units.

def get_duration(self, units: str = 'hr') -> float:
402    def get_duration(self, units: str = 'hr') -> float:
403        """Get the field labeled as duration_hr in the API.
404
405        Args:
406            units: The units in which the duration should be returned. Options:
407                day, hr, min. Defaults to hr.
408
409        Returns:
410            Duration of the haul.
411        """
412        raise NotImplementedError('Use implementor.')

Get the field labeled as duration_hr in the API.

Arguments:
  • units: The units in which the duration should be returned. Options: day, hr, min. Defaults to hr.
Returns:

Duration of the haul.

def get_cpue_weight(self, units: str = 'kg/ha') -> float:
414    def get_cpue_weight(self, units: str = 'kg/ha') -> float:
415        """Get the value of field cpue_kgha with validity assert.
416
417        Args:
418            units: The desired units for the catch per unit effort. Options:
419                kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha.
420
421        Raises:
422            AssertionError: Raised if this field was not given by the API or
423            could not be parsed as expected.
424
425        Returns:
426            Catch weight divided by net area (kg / hectares) if available. See
427            metadata. Will be zero if a zero catch record.
428        """
429        raise NotImplementedError('Use implementor.')

Get the value of field cpue_kgha with validity assert.

Arguments:
  • units: The desired units for the catch per unit effort. Options: kg/ha, kg/km2, kg1000/km2. Defaults to kg/ha.
Raises:
  • AssertionError: Raised if this field was not given by the API or
  • could not be parsed as expected.
Returns:

Catch weight divided by net area (kg / hectares) if available. See metadata. Will be zero if a zero catch record.

def get_cpue_count(self, units: str = 'count/ha') -> float:
431    def get_cpue_count(self, units: str = 'count/ha') -> float:
432        """Get the value of field cpue_noha with validity assert.
433
434        Args:
435            units: The desired units for the catch per unit effort. Options:
436                count/ha, count/km2, and count1000/km2. Defaults to count/ha.
437
438        Raises:
439            AssertionError: Raised if this field was not given by the API or
440            could not be parsed as expected.
441
442        Returns:
443            Catch number divided by net sweep area if available (count /
444            hectares). See metadata. Will be zero if a zero catch record.
445        """
446        raise NotImplementedError('Use implementor.')

Get the value of field cpue_noha with validity assert.

Arguments:
  • units: The desired units for the catch per unit effort. Options: count/ha, count/km2, and count1000/km2. Defaults to count/ha.
Raises:
  • AssertionError: Raised if this field was not given by the API or
  • could not be parsed as expected.
Returns:

Catch number divided by net sweep area if available (count / hectares). See metadata. Will be zero if a zero catch record.

def get_weight(self, units: str = 'kg') -> float:
448    def get_weight(self, units: str = 'kg') -> float:
449        """Get the value of field weight_kg with validity assert.
450
451        Args:
452            units: The units in which the weight should be returned. Options are
453                g, kg for grams and kilograms respectively. Deafults to kg.
454
455        Raises:
456            AssertionError: Raised if this field was not given by the API or
457            could not be parsed as expected.
458
459        Returns:
460            Taxon weight (kg) if available. See metadata. Will be zero if a zero
461            catch record.
462        """
463        raise NotImplementedError('Use implementor.')

Get the value of field weight_kg with validity assert.

Arguments:
  • units: The units in which the weight should be returned. Options are g, kg for grams and kilograms respectively. Deafults to kg.
Raises:
  • AssertionError: Raised if this field was not given by the API or
  • could not be parsed as expected.
Returns:

Taxon weight (kg) if available. See metadata. Will be zero if a zero catch record.

def get_count(self) -> float:
465    def get_count(self) -> float:
466        """Get the value of field count with validity assert.
467
468        Raises:
469            AssertionError: Raised if this field was not given by the API or
470            could not be parsed as expected.
471
472        Returns:
473            Total number of organism individuals in haul. Will be zero if a zero
474            catch record.
475        """
476        raise NotImplementedError('Use implementor.')

Get the value of field count with validity assert.

Raises:
  • AssertionError: Raised if this field was not given by the API or
  • could not be parsed as expected.
Returns:

Total number of organism individuals in haul. Will be zero if a zero catch record.

def get_bottom_temperature(self, units='c') -> float:
478    def get_bottom_temperature(self, units='c') -> float:
479        """Get the value of field bottom_temperature_c with validity assert.
480
481        Args:
482            units: The units in which the temperature should be returned.
483                Options: c or f for Celcius and Fahrenheit respectively.
484                Defaults to c.
485
486        Raises:
487            AssertionError: Raised if this field was not given by the API or
488            could not be parsed as expected.
489
490        Returns:
491            Bottom temperature associated with observation / inferrence if
492            available.
493        """
494        raise NotImplementedError('Use implementor.')

Get the value of field bottom_temperature_c with validity assert.

Arguments:
  • units: The units in which the temperature should be returned. Options: c or f for Celcius and Fahrenheit respectively. Defaults to c.
Raises:
  • AssertionError: Raised if this field was not given by the API or
  • could not be parsed as expected.
Returns:

Bottom temperature associated with observation / inferrence if available.

def get_surface_temperature(self, units='c') -> float:
496    def get_surface_temperature(self, units='c') -> float:
497        """Get the value of field surface_temperature_c with validity assert.
498
499        Args:
500            units: The units in which the temperature should be returned.
501                Options: c or f for Celcius and Fahrenheit respectively.
502                Defaults to c.
503
504        Raises:
505            AssertionError: Raised if this field was not given by the API or
506            could not be parsed as expected.
507
508        Returns:
509            Surface temperature associated with observation / inferrence if
510            available.
511        """
512        raise NotImplementedError('Use implementor.')

Get the value of field surface_temperature_c with validity assert.

Arguments:
  • units: The units in which the temperature should be returned. Options: c or f for Celcius and Fahrenheit respectively. Defaults to c.
Raises:
  • AssertionError: Raised if this field was not given by the API or
  • could not be parsed as expected.
Returns:

Surface temperature associated with observation / inferrence if available.

def is_complete(self) -> bool:
514    def is_complete(self) -> bool:
515        """Determine if this record has all of its values filled in.
516
517        Returns:
518            True if all optional fields have a parsed value with the expected
519            type and false otherwise.
520        """
521        raise NotImplementedError('Use implementor.')

Determine if this record has all of its values filled in.

Returns:

True if all optional fields have a parsed value with the expected type and false otherwise.

def to_dict(self) -> dict:
523    def to_dict(self) -> dict:
524        """Serialize this Record to a dictionary form.
525
526        Serialize this Record to a dictionary form, including only field names
527        that would be found on records returned from the API service.
528
529        Returns:
530            Dictionary with field names matching those found in the API results
531            with incomplete records having some values as None.
532        """
533        return {
534            'year': self.get_year(),
535            'srvy': self.get_srvy(),
536            'survey': self.get_survey(),
537            'survey_id': self.get_survey_id(),
538            'cruise': self.get_cruise(),
539            'haul': self.get_haul(),
540            'stratum': self.get_stratum(),
541            'station': self.get_station(),
542            'vessel_name': self.get_vessel_name(),
543            'vessel_id': self.get_vessel_id(),
544            'date_time': self.get_date_time(),
545            'latitude_dd': self.get_latitude(),
546            'longitude_dd': self.get_longitude(),
547            'species_code': self.get_species_code(),
548            'common_name': self.get_common_name(),
549            'scientific_name': self.get_scientific_name(),
550            'taxon_confidence': self.get_taxon_confidence(),
551            'cpue_kgha': self.get_cpue_weight_maybe(units='kg/ha'),
552            'cpue_kgkm2': self.get_cpue_weight_maybe(units='kg/km2'),
553            'cpue_kg1000km2': self.get_cpue_weight_maybe(units='kg1000/km2'),
554            'cpue_noha': self.get_cpue_count_maybe(units='count/ha'),
555            'cpue_nokm2': self.get_cpue_count_maybe(units='count/km2'),
556            'cpue_no1000km2': self.get_cpue_count_maybe(units='count1000/km2'),
557            'weight_kg': self.get_weight(units='kg'),
558            'count': self.get_count(),
559            'bottom_temperature_c': self.get_bottom_temperature_maybe(
560                units='c'
561            ),
562            'surface_temperature_c': self.get_surface_temperature_maybe(
563                units='c'
564            ),
565            'depth_m': self.get_depth(units='m'),
566            'distance_fished_km': self.get_distance_fished(units='km'),
567            'net_width_m': self.get_net_width(units='m'),
568            'net_height_m': self.get_net_height(units='m'),
569            'area_swept_ha': self.get_area_swept(units='ha'),
570            'duration_hr': self.get_duration(units='hr')
571        }

Serialize this Record to a dictionary form.

Serialize this Record to a dictionary form, including only field names that would be found on records returned from the API service.

Returns:

Dictionary with field names matching those found in the API results with incomplete records having some values as None.