Applying aggregations to only certain subsets of catalogs? #544
Unanswered
riley-brady
asked this question in
Q&A
Replies: 1 comment
-
unfortunately, this is not supported. However, if you are okay with working with two catalog objects, you could try the following cat = intake.open_esm_datastore(.... )
from intake_esm.cat import Aggregation
cat_subset_1 = cat.search(source='a')
# Remove `source` from `groupby_attrs`
cat_subset_1.esmcat.aggregation_control.groupby_attrs = ['scenario', 'frequency']
# Instantiate an `Aggregation` for `source` and add it to the existing list of aggregations
aggregation = Aggregation(type='join_new', attribute_name='source', options={'coords': 'minimal', 'compat': 'override'})
cat_subset_1.esmcat.aggregation_control.aggregations += aggregation
# Load the data
dsets_1 = cat_subset_1.to_dataset_dict(.....)
cat_subset_2 = cat.search(source='b')
dsets_2 = cat_subset_2.to_dataset_dict(....) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to apply aggregations to only certain subsets of a catalog?
For instance, imagine I have a setup like
I would like
intake-esm
to concatenate over amodel
dimension, only for certain subsets of the catalog.For datasets from
source='a'
, each model is the same resolution so they can be concatenated into a multi-model ensemble mean. For datasets fromsource='b'
(e.g. CMIP6), they are all different resolutions and cannot be concatenated.If I take a catalog subset with source 'a', this aggregation works perfectly, but of course throws an error if the subset includes source 'b'.
Possible solutions (not ideal):
subset.to_dataset_dict(aggregate=False)
model
rule for concatenatingBeta Was this translation helpful? Give feedback.
All reactions