-
Notifications
You must be signed in to change notification settings - Fork 15
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
Global time series plots look different after CDAT replacement #600
Comments
Looking at https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.forsyth2/zppy_test_complete_run_www/zppy_pre_v2.5.0rc2/v2.LR.historical_0201/global_time_series/global_time_series_1850-1860_results/ (the results from before releasing v2.5.0, e.g. shortly after merging the land plot inclusion (#584) -- it appears the land plots were always blank. That wasn't caught during the testing phase. |
Interestingly, it appears Pre-519:
Post-519:
Even applying |
@tomvothecoder Is there anything about my code changes in #519 that would cause these plot differences? In particular, does xCDAT/xarray handle end-year boundaries (e.g., last year to be included) differently than |
@forsyth2 I think there two things we can check at this point.
Also, I'm not sure why the land plots were not showing up in the pre#519? |
Comparison of print-statement outputs Notes:
Code block 1
The answer is no, it does not. Notes:
In
Pre-519
Output: Post-519
Output: 20 instances of
So, it looks like aside from Code block 2
The answer is no, they are not. Post-519 adds 1860 (as mentioned in #600 (comment) above too).
Pre-519
Output: for each region (
Post-519
Output: for each region (
Here, we see that 1860 has been added to the time list. Code block 3
Pre-519
Output:
Post-519
Output:
Comparison of variablesThe diff of
We can see that the variables are not being computed as the same values for the non-ocean plots. These were computed using this script: Diff script
Why weren't the lands plots working pre-519?
It looks like both of the land plots were running into dimensions issues:
That implies there were only 10 years but 11 data points. So, when the CDAT change made it 11 years instead of 10 years, there was suddenly a matching number of years to data points. This dimensions issue seems similar, if not identical, to the one mentioned in #571 (which is still open). This exact error is mentioned in #400 (comment), which eventually led to #571 being opened. From pre-519:
|
@chengzhuzhang See error descriptions above. How should we proceed with this? #519 changed the global time series plots to no longer match the expected results (at https://web.lcrc.anl.gov/public/e3sm/zppy_test_resources/expected_complete_run/global_time_series/global_time_series_1850-1860_results/). That means I now can't properly test other Options:
|
Possible CDAT behaviorJust a clue for debugging: you might want to watch out for There is a "slice flag" feature that is really confusing, but the default value is What to tryYou can try running the Python debugger on the pre-519 |
Properly configuring the debuggerFor reference: to use the Unified environment in VS Code debugger:
The last line is important for debugging into other packages. Debugging
That leads to:
From https://github.com/CDAT/cdms/blob/3f8c7baa359f428628a666652ecf361764dc7b7a/Lib/cdmsNode.py#L468, we know:
Here, we have the following in the variable explorer:
I'm wondering if that's the 11 values for the time series variable. For
The
I don't see anything here that would suggest 11 years of data(e.g., 121 for 1 month on the end or 132 for a full extra 12 months). So, my conclusion is that the pre-519 (with CDAT, using |
In an effort to further isolate the buggy code I wrote the following script: Pre/Post-519 comparison script
We can see that the diff of the y values in the plots matches what I listed above in #600 (comment). This suggests this stand-alone script is written correctly. Aside from being stand-alone, this script also uses the same input directory for both pre- and post-519 code. We can see that from the very beginning, the pre-519 code is working with 120 months (10 years) while the post-519 code is working with 11 years. @tomvothecoder @chengzhuzhang This confirms for sure that |
Results with debugger: pre-519
post-519
That brings us to
Before, Before that line, we call the
When we get to this function, Following the
|
In It appears that in
sets So, something wrong is happening in It looks like this block in
is setting The debugger won't let me go further into However, if we look deeper into So the issue lies much earlier than this -- when the |
In
Here, Going further up:
Here, Going further up: Going further up:
The Going further up:
However, I'm now able to pull more and more code outside the xcdat/xarray package, for easier debugging:
I now see that the slicing happens in
I now have:
So, getting the "time" attribute of "PRECC" seems to be slicing "PRECC" incorrectly... I'm trying to debug why that would happen. My best guess so far is something about the seasons handling winter as |
@forsyth2 thanks for creating the standalone code for debugging, I took it and further simplified. Please see below:
You can play with this to show why there is difference in your implement. In brief, the EAM output has time value recorded at the end of the time interval. While |
In
Before this line is called, So, we can work earlier into the code now: By the time we get to this line in
we have This appears even earlier in the code. By the time we get to the following line in
we have |
@chengzhuzhang Ah thank you, I will look into |
@chengzhuzhang That issue was carried over to #571. Are you saying that using |
I meant that #400 has a similar script for resolving a similar issue. It also explained the rational behind time averaging. It is possible that with |
By default, xCDAT will behave the same way as CDAT by using the existing time bounds to create the temporal weights. Basically, I think the only difference here is the CDAT is centering time coordinate automatically while xCDAT does not. Centering time coordiante with xCDAT might resolve the differences, but I'm not exactly sure. |
@tomvothecoder thank you for chiming in! After some experiment (e.g. saving time weights from xcdat), I think we can confirm that centering time should be the right solution. Without centering time, the xcdat codes would create 11 annual mean values with the last time point 1860-01-01, that has a time weights of 1.0. In the case xCDAT implementation, since xCDAT won't center time automatically by default as CDAT, center_times=True is needed to get the correct month and weights. |
The plots also look correct when I implement |
Request criteria
Issue description
It appears the merging of #519 altered the appearance of the global time series plots. I ran the complete-run test on
main
and it showed differences for global time series.Before merging (these plots also match the expected plots in the complete-run test): https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.forsyth2/zppy_test_complete_run_www/test-2.5.0/v2.LR.historical_0201/global_time_series/global_time_series_1850-1860_results/
![image](https://private-user-images.githubusercontent.com/30700190/339068760-a9ccc2f6-e8b4-417f-9b60-c6b8352c44bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwODU2OTMsIm5iZiI6MTczOTA4NTM5MywicGF0aCI6Ii8zMDcwMDE5MC8zMzkwNjg3NjAtYTljY2MyZjYtZThiNC00MTdmLTliNjAtYzZiODM1MmM0NGJmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDA3MTYzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ1NzRhYzA1YTYyOTZhNmUyNDZjYzUxOGNkOGY1NGExZmExN2I5YTZiMTg2NWJiZjI3MjAwZTg3YTM0NTlhMmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.qlJbvssLSnvYnWufOIwFMtWVbdPnMMi2JfyirfX7dtw)
![image](https://private-user-images.githubusercontent.com/30700190/339068807-0b7fc65b-833a-447e-ac49-de94fe5d9d47.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwODU2OTMsIm5iZiI6MTczOTA4NTM5MywicGF0aCI6Ii8zMDcwMDE5MC8zMzkwNjg4MDctMGI3ZmM2NWItODMzYS00NDdlLWFjNDktZGU5NGZlNWQ5ZDQ3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDA3MTYzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU1NmU5ODdmMzg1N2Y5ZTU4YzAxNGUyODgzOTlmNGNhOTMyMGE3OTE3MjUwNmYyZjVhYzY1YmU4ODE0ZTNiZTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.7Z9O6Tlx2_LnnMWSZJeYlkag73T2xcSYMNm9f3Tj8ZY)
After merging: https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.forsyth2/zppy_test_complete_run_www/test-main-20240611/v2.LR.historical_0201/global_time_series/global_time_series_1850-1860_results/
![image](https://private-user-images.githubusercontent.com/30700190/339069656-f562e128-1ede-41e7-bbdc-626c49de2ff6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwODU2OTMsIm5iZiI6MTczOTA4NTM5MywicGF0aCI6Ii8zMDcwMDE5MC8zMzkwNjk2NTYtZjU2MmUxMjgtMWVkZS00MWU3LWJiZGMtNjI2YzQ5ZGUyZmY2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDA3MTYzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJkZDFmNWMwNWJjM2Q2NzkzZGVlM2FiMGZjODNjMjg0OTJiZDI1MTRkYWJjZThiMzgxOGYzZWM5MzdhMGFiMzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.kxa6O2NDNw94yscQQSh5TSK1TOaDW9NdXUzPzzsGz_o)
![image](https://private-user-images.githubusercontent.com/30700190/339069691-4f48ad1b-d1db-4222-b177-628118d451de.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwODU2OTMsIm5iZiI6MTczOTA4NTM5MywicGF0aCI6Ii8zMDcwMDE5MC8zMzkwNjk2OTEtNGY0OGFkMWItZDFkYi00MjIyLWIxNzctNjI4MTE4ZDQ1MWRlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDA3MTYzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNmNGFkNGZiMWY4ZTRjMTE4Mzc2NGY1OTc0MWQ1OWIwMmQ0ZjRiNWE0ZTU1M2ZiYjI5MzRkYTE3ZjViZmE3YjkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KvhL1l1E4e0SVGDHlfMebDUAEXFwqpuehpsIE17gA_w)
Original plots: the plots seem similar but definitely not identical. The large jump at the end of the post-519 graphs make me think #519 broke something rather than fixed something.
Land plots: There must have been some mistake in updating the expected Land plots prior to releasing 2.5.0 -- the expected plots show nothing plotted.... The post-519 plots actually have results. That said, these results are clearly incorrect, considering they're for the most part just horizontal lines.
The text was updated successfully, but these errors were encountered: