-
Notifications
You must be signed in to change notification settings - Fork 75
Remove deprecated cosima_cookbook
references from ACCESS-NRI catalog tutorial
#608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
The last cell fails df = get_detailed_variable_info(catalog, experiment, 'tau_x') But if all else is good, I suggest we merge and we fix that tomorrow? |
Just coming into Melbourne now so I can't check, but the last cell looks like a relatively straightforward fix. I'll take a proper look later/first thing tomorrow. |
@charles-turner-1 whenever you find sometime have a look and if you fix the last cell feel free to approve and merge! |
@@ -0,0 +1,7778 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,7778 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line #3. path=".*output000.*"
This line can be deleted (I've checked & it's not doing anything)
Reply via ReviewNB
@@ -0,0 +1,7778 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if columns_with_iterables: df = df.explode(columns_with_iterables, ignore_index=True) df.index = df[variable_column_name] Line #29. df.index = df[variable_column_name]
I think that this will separately explode on each column, which is probably not what we want. It looks like @adele-morrison wrote this - are you able to confirm for me?
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out I wrote this - @navidcy you happy for me push the changes to this branch?
def get_detailed_variable_info(intake_catalog, experiment_name : str, variable : str | None = None) -> "pd.Dataframe":
"""
Get detailed information about all the variables available in an experiment contained within the catalog.
If a specific variable is passed, then the returned dataframe will be filtered to include only information
about that variable
Returns a pandas dataframe, reorganised to use the variable as the index.
Parameters:
-----------
intake_catalog:
The variable holding the intake catalog. If you have opened the catalog using
`cat = intake.cat.access_nri`, then `intake_catalog=cat`, etc.
experiment_name: str
The name of the experiment you are interested in. Eg. `experiment = "01deg_jra55v13_ryf9091"`
variable: str | None
If you want detailed information about just a single variable, then pass it here. For
example, if you only want information about potential temperature, pass `variable='pot_temp'`
"""
expt_ds = intake_catalog[experiment_name]
columns_with_iterables = list(expt_ds.esmcat.columns_with_iterables)
variable_column_name = expt_ds.esmcat.aggregation_control.variable_column_name
+ for col in columns_with_iterables:
+ expt_ds.df[col] = expt_ds.df[col].astype("object").map(lambda x: list(map(str, x)))
df = expt_ds.df.copy()
if columns_with_iterables:
df = df.explode(columns_with_iterables, ignore_index=True)
df.index = df[variable_column_name]
df.drop(columns=variable_column_name, inplace=True)
if variable is not None:
df = df.loc[variable]
return df fixes the failing cell, but I'm not sure it gives the intended results. |
…ookbook_refs' into ncc/remove-cosima_cookbook_refs
It's time to let go of the
cosima_cookbook
!