@@ -101,7 +101,7 @@ def __init__(self, provider_def):
101101 self .ds = pyarrow .dataset .dataset (self .source , filesystem = self .fs )
102102
103103 LOGGER .debug ('Grabbing field information' )
104- self .fields = self . get_fields () # Must be set to visualise queryables
104+ self .get_fields () # Must be set to visualise queryables
105105
106106 # Column names for bounding box data.
107107 if None in [self .x_field , self .y_field ]:
@@ -148,42 +148,42 @@ def get_fields(self):
148148 :returns: dict of fields
149149 """
150150
151- fields = dict ()
152-
153- for field_name , field_type in zip (self .ds .schema .names ,
154- self .ds .schema .types ):
155- # Geometry is managed as a special case by pygeoapi
156- if field_name == 'geometry' :
157- continue
158-
159- field_type = str (field_type )
160- converted_type = None
161- converted_format = None
162- if field_type .startswith (('int' , 'uint' )):
163- converted_type = 'integer'
164- converted_format = field_type
165- elif field_type == 'double' or field_type .startswith ('float' ):
166- converted_type = 'number'
167- converted_format = field_type
168- elif field_type == 'string' :
169- converted_type = 'string'
170- elif field_type == 'bool' :
171- converted_type = 'boolean'
172- elif field_type .startswith ('timestamp' ):
173- converted_type = 'string'
174- converted_format = 'date-time'
175- else :
176- LOGGER .error (f'Unsupported field type { field_type } ' )
151+ if not self . _fields :
152+
153+ for field_name , field_type in zip (self .ds .schema .names ,
154+ self .ds .schema .types ):
155+ # Geometry is managed as a special case by pygeoapi
156+ if field_name == 'geometry' :
157+ continue
158+
159+ field_type = str (field_type )
160+ converted_type = None
161+ converted_format = None
162+ if field_type .startswith (('int' , 'uint' )):
163+ converted_type = 'integer'
164+ converted_format = field_type
165+ elif field_type == 'double' or field_type .startswith ('float' ):
166+ converted_type = 'number'
167+ converted_format = field_type
168+ elif field_type == 'string' :
169+ converted_type = 'string'
170+ elif field_type == 'bool' :
171+ converted_type = 'boolean'
172+ elif field_type .startswith ('timestamp' ):
173+ converted_type = 'string'
174+ converted_format = 'date-time'
175+ else :
176+ LOGGER .error (f'Unsupported field type { field_type } ' )
177177
178- if converted_format is None :
179- fields [field_name ] = {'type' : converted_type }
180- else :
181- fields [field_name ] = {
182- 'type' : converted_type ,
183- 'format' : converted_format ,
184- }
178+ if converted_format is None :
179+ self . _fields [field_name ] = {'type' : converted_type }
180+ else :
181+ self . _fields [field_name ] = {
182+ 'type' : converted_type ,
183+ 'format' : converted_format ,
184+ }
185185
186- return fields
186+ return self . _fields
187187
188188 @crs_transform
189189 def query (
0 commit comments