@@ -126,6 +126,7 @@ def __init__(
126
126
self .derivedcat = registry or default_registry
127
127
self ._entries = {}
128
128
self ._requested_variables = []
129
+ self ._columns_with_iterables = columns_with_iterables or []
129
130
self .datasets = {}
130
131
self ._validate_derivedcat ()
131
132
@@ -218,12 +219,31 @@ def interactive(self) -> None:
218
219
"""
219
220
Use itables to display the catalog in an interactive table. Use polars
220
221
for performance ideally. Fall back to pandas if not.
222
+
223
+ We have to explode columns with iterables, otherwise javascript stringifcation
224
+ can cause ellipsis to be rendered directly into the interactive table,
225
+ losing actual data and inserting junk.
221
226
"""
222
227
try :
223
228
df = self .esmcat ._frames .polars # type:ignore[union-attr]
229
+ if self ._columns_with_iterables :
230
+ df = df .explode (self ._columns_with_iterables )
224
231
except AttributeError :
225
232
df = self .esmcat .df
226
- return itables .show (df )
233
+ if self ._columns_with_iterables :
234
+ df = df .explode (self ._columns_with_iterables , ignore_index = True )
235
+
236
+ return itables .show (
237
+ df ,
238
+ search = {'regex' : True , 'caseInsensitive' : True },
239
+ layout = {'top1' : 'searchPanes' },
240
+ searchPanes = {
241
+ 'layout' : 'columns-3' ,
242
+ 'cascadePanes' : True ,
243
+ 'columns' : [i for i , _ in enumerate (df .columns )],
244
+ },
245
+ maxBytes = 0 ,
246
+ )
227
247
228
248
def __len__ (self ) -> int :
229
249
return len (self .keys ())
0 commit comments