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

Modify how dimensions ids are set in coupler history #6268

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

rljacob
Copy link
Member

@rljacob rljacob commented Feb 27, 2024

The coupler history was not using the dimension id of coordinate variables when defining dimensions of variables for most of the attribute vectors. This made the coupler history hard to use with viz/analysis tools like ncvis. Allow dimension ids of coordinate variables to be passed back to calling function and then used in future calls that define additional variables. Coupler history can then be viewed with ncvis and possibly other tools.

[BFB] doesn't change content of variables in a coupler history.


This ncdump illustrates the problem.

dimensions:
	time = UNLIMITED ; // (1 currently)
	doma_nx = 384 ;
	doma_ny = 1 ;
variables:
	double doma_lat(time, doma_ny, doma_nx) ;
		doma_lat:long_name = "latitude" ;
	double doma_lon(time, doma_ny, doma_nx) ;
		doma_lon:long_name = "longitude" ;
	double x2a_Sx_tref(time, x2a_ny, x2a_nx) ;
		x2a_Sx_tref:long_name = "Reference temperature at 2 meters" ;

Since x2a_Sx_tref doesn't have the same lat, lon dimension ids of the variables with the actual latitude and longitude (doma_ny vs. x2a_ny), most netcdf vis programs won't know how to display x2a_Sx_tref.

The fix changes the dimension ids for the variable to be:
double x2a_Sx_tref(time, doma_ny, doma_nx) ;

And similar for all other variables in the coupler history (which has variables on every mesh).

The coupler history was not using the dimension id of coordinate variables
when defining dimensions of variables for most of the attribute vectors. This made
the coupler history hard to use with viz/analysis tools like ncvis. Allow
dimension ids of coordinate variables to be passed back to calling function
and then used in future calls that define additional variables.  Coupler history
can then be viewed with ncvis and possibly other tools.
@rljacob rljacob requested a review from jonbob February 27, 2024 20:22
@rljacob rljacob self-assigned this Feb 27, 2024
@rljacob rljacob added this to the v3.0.0-rc milestone Feb 27, 2024
Copy link

PR Preview Action v1.4.7
🚀 Deployed preview to https://E3SM-Project.github.io/E3SM/pr-preview/pr-6268/
on branch gh-pages at 2024-02-27 20:24 UTC

Copy link
Contributor

@jonbob jonbob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved based on a visual inspection -- and looks like a very important change

@jonbob
Copy link
Contributor

jonbob commented Feb 27, 2024

@rljacob -- I approved just from looking at the code, but please let me know if it also needs to be tested

@rljacob
Copy link
Member Author

rljacob commented Feb 27, 2024

@jonbob can you try it with an ice sheet compset? I just did watercycle ne4pg2.

@jonbob
Copy link
Contributor

jonbob commented Feb 27, 2024

Sure -- anything I should look for?

@rljacob
Copy link
Member Author

rljacob commented Feb 27, 2024

Make whatever mods you need to output a coupler history. Or run one of the MALI tests which will do it. Just want to make sure it writes without error when atmosphere is stub. You could try looking at the glacier coupler fields with ncvis.

@jonbob
Copy link
Contributor

jonbob commented Feb 27, 2024

I ran SMS.T62_oQU120_ais20.MPAS_LISIO_TEST.chrysalis_intel successfully and the cpl history file could be visualized with ncvis, including the g2x and x2g fields

@jonbob
Copy link
Contributor

jonbob commented Feb 27, 2024

ncvis was unhappy with some fields, like x2a_So_t (I think) -- it complained

EXCEPTION (wxImagePanel.cpp, Line 651) Y (latitude) dimension has nonpositive range [-88.541950,-88.541950]

but I don't think that's related to this PR

@rljacob
Copy link
Member Author

rljacob commented Feb 28, 2024

Agreed. That's either an ncvis problem or different issue with how the domains are initialized when the component is DATM.

@rljacob rljacob modified the milestones: v3.0.0-rc1, v3.0.0-rc2 Feb 29, 2024
rljacob added a commit that referenced this pull request Mar 1, 2024
The coupler history was not using the dimension id of coordinate
variables when defining dimensions of variables for most of the attribute
vectors. This made the coupler history hard to use with viz/analysis tools
like ncvis. Allow dimension ids of coordinate variables to be passed back to
calling function and then used in future calls that define additional variables.
Coupler history can then be viewed with ncvis and possibly other tools.

[BFB] doesn't change content of variables in a coupler history.
@rljacob
Copy link
Member Author

rljacob commented Mar 1, 2024

merged to next.

@rljacob rljacob merged commit f5fc8f8 into master Mar 1, 2024
10 checks passed
@rljacob rljacob deleted the rljacob/cpl/fix-cplhist branch March 1, 2024 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants