@@ -539,44 +539,48 @@ def _finalise(self):
539
539
`None`
540
540
541
541
"""
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
543
547
544
548
# ----------------------------------------------------------------
545
- # Select matching constructs from non-UM files (before
549
+ # Select matching constructs from netCDF datasets (before
546
550
# aggregation)
547
551
# ----------------------------------------------------------------
548
552
select = self .select
549
- if select and not UM :
553
+ if select and only_netCDF :
550
554
self .constructs = self .constructs .select_by_identity (* select )
551
555
552
556
# ----------------------------------------------------------------
553
- # Aggregate the output fields/ domains
557
+ # Aggregate the output fields or domains
554
558
# ----------------------------------------------------------------
555
559
if self .aggregate and len (self .constructs ) > 1 :
556
560
aggregate_options = self .aggregate_options
557
561
# 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 :
559
563
aggregate_options ["relaxed_units" ] = True
560
564
561
565
self .constructs = cf_aggregate (
562
566
self .constructs , ** aggregate_options
563
567
)
564
568
565
569
# ----------------------------------------------------------------
566
- # Add standard names to UM/PP fields (after aggregation)
570
+ # Add standard names to non-netCDF fields (after aggregation)
567
571
# ----------------------------------------------------------------
568
- if UM :
572
+ if not only_netCDF :
569
573
for f in self .constructs :
570
574
standard_name = f ._custom .get ("standard_name" , None )
571
575
if standard_name is not None :
572
576
f .set_property ("standard_name" , standard_name , copy = False )
573
577
del f ._custom ["standard_name" ]
574
578
575
579
# ----------------------------------------------------------------
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)
578
582
# ----------------------------------------------------------------
579
- if select and UM :
583
+ if select and not only_netCDF :
580
584
self .constructs = self .constructs .select_by_identity (* select )
581
585
582
586
super ()._finalise ()
@@ -721,7 +725,7 @@ def _read(self, dataset):
721
725
# ------------------------------------------------------------
722
726
# Try to read as a GRIB dataset
723
727
#
724
- # Not yet available! When (if) the time comes, the framework
728
+ # Not yet availabl. When (if! ) the time comes, the framework
725
729
# will be:
726
730
# ------------------------------------------------------------
727
731
#
0 commit comments