@@ -539,44 +539,48 @@ def _finalise(self):
539539 `None`
540540
541541 """
542- UM = "UM" in self .unique_dataset_categories
542+ # Whether or not there were only netCDF datasets
543+ only_netCDF = self .unique_dataset_categories == set (("netCDF" ,))
544+
545+ # Whether or not there were any UM datasets
546+ some_UM = "UM" in self .unique_dataset_categories
543547
544548 # ----------------------------------------------------------------
545- # Select matching constructs from non-UM files (before
549+ # Select matching constructs from netCDF datasets (before
546550 # aggregation)
547551 # ----------------------------------------------------------------
548552 select = self .select
549- if select and not UM :
553+ if select and only_netCDF :
550554 self .constructs = self .constructs .select_by_identity (* select )
551555
552556 # ----------------------------------------------------------------
553- # Aggregate the output fields/ domains
557+ # Aggregate the output fields or domains
554558 # ----------------------------------------------------------------
555559 if self .aggregate and len (self .constructs ) > 1 :
556560 aggregate_options = self .aggregate_options
557561 # Set defaults specific to UM fields
558- if UM and "strict_units" not in aggregate_options :
562+ if some_UM and "strict_units" not in aggregate_options :
559563 aggregate_options ["relaxed_units" ] = True
560564
561565 self .constructs = cf_aggregate (
562566 self .constructs , ** aggregate_options
563567 )
564568
565569 # ----------------------------------------------------------------
566- # Add standard names to UM/PP fields (after aggregation)
570+ # Add standard names to non-netCDF fields (after aggregation)
567571 # ----------------------------------------------------------------
568- if UM :
572+ if not only_netCDF :
569573 for f in self .constructs :
570574 standard_name = f ._custom .get ("standard_name" , None )
571575 if standard_name is not None :
572576 f .set_property ("standard_name" , standard_name , copy = False )
573577 del f ._custom ["standard_name" ]
574578
575579 # ----------------------------------------------------------------
576- # Select matching constructs from UM files (after setting
577- # their standard names)
580+ # Select matching constructs from non-netCDF files (after
581+ # setting their standard names)
578582 # ----------------------------------------------------------------
579- if select and UM :
583+ if select and not only_netCDF :
580584 self .constructs = self .constructs .select_by_identity (* select )
581585
582586 super ()._finalise ()
@@ -721,7 +725,7 @@ def _read(self, dataset):
721725 # ------------------------------------------------------------
722726 # Try to read as a GRIB dataset
723727 #
724- # Not yet available! When (if) the time comes, the framework
728+ # Not yet availabl. When (if! ) the time comes, the framework
725729 # will be:
726730 # ------------------------------------------------------------
727731 #
0 commit comments