Skip to content
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

Required changes to CABLE model output #1

Open
1 of 3 tasks
SeanBryan51 opened this issue Oct 27, 2023 · 10 comments
Open
1 of 3 tasks

Required changes to CABLE model output #1

SeanBryan51 opened this issue Oct 27, 2023 · 10 comments

Comments

@SeanBryan51
Copy link
Contributor

SeanBryan51 commented Oct 27, 2023

This issue thread documents the changes needed for CABLE model output to be used directly with ILAMB.

  • Albedo units are not CF compliant: change from - to 1 or remove units attribute.
  • Rename netCDF dimensions and coordinate variables: x -> lon, y -> lat. Note: this is not required by CF conventions.
  • Add time bounds variable. Note: this is not required by CF conventions.
    • Explicit time bounds will be required if we want to run ILAMB on model outputs that are split across multiple years (see #81 in the ILAMB repository).

Note: ILAMB is tested with CABLE model output from the latest trunk (CABLE3).

@aidanheerdegen
Copy link

  • It looks like ILAMB is not fully model agnostic and makes assumptions in model output data. For example, in ilamblib.py:L754, ILAMB assumes dimensions for latitude, longitude and time are called lat, lon and time respectively.

Shouldn't iLAMB be fixed to properly support CF conventions? That could be a lot easier than forcing all data to comply with an arbitrary "standard".

@SeanBryan51
Copy link
Contributor Author

@aidanheerdegen I agree. There is currently ongoing development of a new version of ILAMB which uses xarray as its backend but it is yet to be released. It looks like they are taking a CF compliant approach in the new version (e.g. see here).

It might be worth submitting a patch to (current) ILAMB to support x and y as the dimension / coordinate variable names when reading NetCDF datasets.

@aidanheerdegen
Copy link

There is currently ongoing development of a new version of ILAMB which uses xarray as its backend but it is yet to be released. It looks like they are taking a CF compliant approach in the new version (e.g. see here).

Seems promising, but have they heard of https://github.com/xarray-contrib/cf-xarray?

I'd be using that in a heartbeat for CF compliance and making data access as agnostic as possible.

It might be worth submitting a patch to (current) ILAMB to support x and y as the dimension / coordinate variable names when reading NetCDF datasets.

Agreed. From a cursory appraisal it looks like the code would be relatively easy to change to support this.

@SeanBryan51
Copy link
Contributor Author

Judging from this comment, I think the developer is aware of cf-xarray

@aidanheerdegen
Copy link

Judging from this comment, I think the developer is aware of cf-xarray

Hah hah! Good catch, actually reading the code.

Well they have their reasons, but I'd standardise on the good thing and treat the outlier as the exception.

@SeanBryan51
Copy link
Contributor Author

Here is the patch to allow for flexible NetCDF dimension names: rubisco-sfa/ILAMB#105

@aidanheerdegen
Copy link

Here is the patch to allow for flexible NetCDF dimension names: rubisco-sfa/ILAMB#105

This doesn't implement CF conventions (examining units, standard_name or axis attribute). I thought the CABLE data had some of the correct attributions, but perhaps I got confused?

@SeanBryan51
Copy link
Contributor Author

SeanBryan51 commented Sep 19, 2024

@aidanheerdegen I see. I agree that examining the attributes on the coordinate variables for either units, standard_name or axis attributes would be a more future proof solution.

Here are the NetCDF coordinate variables currently in the CABLE model output along with their attributes:

double time(time) ;
        time:units = "seconds since 1901-01-01 00:00:00" ;
        time:coordinate = "GMT" ;
        time:calendar = "standard" ;
float x(x) ;
        x:units = "degrees_east" ;
        x:comment = "x coordinate variable for GrADS compatibility" ;
float y(y) ;
        y:units = "degrees_north" ;
        y:comment = "y coordinate variable for GrADS compatibility" ;

They all have a units attribute so it should be enough to identify the spatiotemporal axis (T, Z, Y, X) of a given coordinate variable.

@aidanheerdegen
Copy link

aidanheerdegen commented Sep 20, 2024

They all have a units attribute so it should be enough to identify the spatiotemporal axis (T, Z, Y, X) of a given coordinate variable.

Agreed.

I don't think you should do this, but note for completeness you also have the option to add an axis attribute without breaking backwards compatibility with tools that have x, y hard-coded for the lon/lat.

@SeanBryan51
Copy link
Contributor Author

Here is the revised patch: rubisco-sfa/ILAMB#106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants