You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a users of the nzhsm-common library we access locations lists via the dict that defines them, e.g.:
locations=LOCATION_LISTS['NZ']['locations'],
def get_one_location_list(location_list_id):
ll = LOCATION_LISTS.get(location_list_id)
if ll:
return LocationList(location_list_id, ll['locations'])
raise IndexError("LocationList with id %s was not found." % location_list_id)
However, the use of a dict interface does not document the use of the lists, better to have a function(s). There are already 2 functions:
def get_location_list(
location_list_names: List[str], resolution: float = DEFAULT_RESOLUTION, sort_locations: bool = True
) -> Iterable[CodedLocation]:
"""
Get all coded locations within one or more lists.
def get_location_list_names() -> List[str]:
"""
Return a list of valid location lists.
A user may want:
location list ids (e.g. "WLG", "CHC", etc)
a location lists "id" (e.g. "HB", SRWG214")
a location list "name"
lat lon (floating point, at the resource's resolution) of locations in the list
CodedLocations from the list
Proposal:
A LocationList class with the following methods or properties (with get_ prefix if a method):
ids
name
id
coded_locations
coordinates (lat, lon): list of LatLon objects
Done when:
decision on if LocaitonList should have methods or properties
working LocationList class
a helper function get_location_list that takes an id and returns a LocationList object. This will replace the existing function (could be a class method)
The text was updated successfully, but these errors were encountered:
As a users of the
nzhsm-common
library we access locations lists via the dict that defines them, e.g.:However, the use of a dict interface does not document the use of the lists, better to have a function(s). There are already 2 functions:
A user may want:
CodedLocations
from the listProposal:
A
LocationList
class with the following methods or properties (withget_
prefix if a method):ids
name
id
coded_locations
coordinates
(lat, lon): list ofLatLon
objectsDone when:
LocaitonList
should have methods or propertiesLocationList
classget_location_list
that takes anid
and returns aLocationList
object. This will replace the existing function (could be a class method)The text was updated successfully, but these errors were encountered: