| 
13 | 13 |     write_json  | 
14 | 14 | )  | 
15 | 15 | 
 
  | 
 | 16 | +from csep.core.exceptions import CSEPCatalogException  | 
 | 17 | + | 
16 | 18 | from csep.utils import datasets  | 
17 | 19 | from csep.utils import readers  | 
18 | 20 | 
 
  | 
@@ -112,11 +114,13 @@ def load_catalog(filename, type='csep-csv', format='native', loader=None, apply_  | 
112 | 114 |         format (str): ('native', 'csep') determines whether the catalog should be converted into the csep  | 
113 | 115 |                       formatted catalog or kept as native.  | 
114 | 116 |         apply_filters (bool): if true, will apply filters and spatial filter to catalog. time-varying magnitude completeness  | 
115 |  | -                              will still need to be applied.  | 
 | 117 | +                              will still need to be applied. filters kwarg should be included. see catalog  | 
 | 118 | +                              documentation for more details.  | 
116 | 119 | 
  | 
117 | 120 |     Returns (:class:`~csep.core.catalogs.AbstractBaseCatalog`)  | 
118 | 121 |     """  | 
119 | 122 | 
 
  | 
 | 123 | + | 
120 | 124 |     if type not in ('ucerf3', 'csep-csv', 'zmap', 'jma-csv', 'ingv_horus', 'ingv_emrcmt', 'ndk') and loader is None:  | 
121 | 125 |         raise ValueError("type must be one of the following: ('ucerf3', 'csep-csv', 'zmap', 'jma-csv', 'ndk', 'ingv_horus', 'ingv_emrcmt').")  | 
122 | 126 | 
 
  | 
@@ -172,7 +176,10 @@ def load_catalog(filename, type='csep-csv', format='native', loader=None, apply_  | 
172 | 176 |         raise ValueError('format must be either "native" or "csep"')  | 
173 | 177 | 
 
  | 
174 | 178 |     if apply_filters:  | 
175 |  | -        return_val = return_val.filter().filter_spatial()  | 
 | 179 | +        try:  | 
 | 180 | +            return_val = return_val.filter().filter_spatial()  | 
 | 181 | +        except CSEPCatalogException:  | 
 | 182 | +            return_val = return_val.filter()  | 
176 | 183 | 
 
  | 
177 | 184 |     return return_val  | 
178 | 185 | 
 
  | 
@@ -210,7 +217,10 @@ def query_comcat(start_time, end_time, min_magnitude=2.50,  | 
210 | 217 |     print("Fetched ComCat catalog in {} seconds.\n".format(t1 - t0))  | 
211 | 218 | 
 
  | 
212 | 219 |     if apply_filters:  | 
213 |  | -        comcat = comcat.filter().filter_spatial()  | 
 | 220 | +        try:  | 
 | 221 | +            comcat = comcat.filter().filter_spatial()  | 
 | 222 | +        except CSEPCatalogException:  | 
 | 223 | +            comcat = comcat.filter()  | 
214 | 224 | 
 
  | 
215 | 225 |     if verbose:  | 
216 | 226 |         print("Downloaded catalog from ComCat with following parameters")  | 
 | 
0 commit comments