noaa-oar-arl/monet

combining multiple model variables to single pandas column

bbakernoaa opened this issue · 3 comments

Currently the code to combine a Xarray.Dataset to obs iterates over the mapping_table. The mapping table is currently setup to be {'obs_column':'dataset_variable'}. This creates an issue when looping over multiple variables to a single column.

I propose that we switch this to be {"dataset_variable":"obs_column"} or we pass an two arrays with one for the data frame columns and another for dataset variables. What do you guys think?

Good question Barry. I guess I am in favor of the first option, just switch the order. I am bias though, as this would be the easiest to adapt our new naqfc pairing scripts.

Well we could do it two ways. One it could be transparent and keep the {'obs':'dataset'} the same and then in the Monet_accessor switch it in the function call

        for i in mapping_table:
            df = combine_da_to_df_xesmf(
                self.obj[mapping_table[i]], df, col=i, **kwargs)

would be changed to

        for i in mapping_table:
            df = combine_da_to_df_xesmf(
                self.obj[i], df, col=mapping_table[i], **kwargs)

or we switch the format and do it the other way.

https://github.com/noaa-oar-arl/MONET/blob/develop/monet/monet_accessor.py#L857

I like the idea of having it transparent for now... ;)