-
Notifications
You must be signed in to change notification settings - Fork 37
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
Bug fix in module mean_climate_driver.py for regional mean #1133
Open
zhangshixuan1987
wants to merge
19
commits into
main
Choose a base branch
from
zhan391
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changes are made to mean_climate_driver.py to call the updated version of region_subset() function. Specifically, current mean_climate_driver.py passed three input parameters in to region_subset() to mask the data for regional mean climate calculation. However, the region_subset() in pcmdi_metrics.io library required 5 input parameters, leading to the failure of mean_climate_driver.py calculation.
related to #1128 In previous commit, changes in mean_climate_driver.py were made to remove the forced unit conversion for pressure level. Accordingly, the forced unit change in read_json_mean_clim.py should be removed as well. Otherwise, the Metrics () fuction call to decode the metrics json files will return wrong variable names.
Changes are made to mean_climate_driver.py to call the updated version of region_subset() function. Specifically, current mean_climate_driver.py passed three input parameters in to region_subset() to mask the data for regional mean climate calculation. However, the region_subset() in pcmdi_metrics.io library required 5 input parameters, leading to the failure of mean_climate_driver.py calculation.
related to #1128 In previous commit, changes in mean_climate_driver.py were made to remove the forced unit conversion for pressure level. Accordingly, the forced unit change in read_json_mean_clim.py should be removed as well. Otherwise, the Metrics () fuction call to decode the metrics json files will return wrong variable names.
Modify read_json_mean_clim.py module to be consistent with the changes related to #1128 In previous commit related to #1128, changes in mean_climate_driver.py were made to remove the forced unit conversion for pressure level. Accordingly, the forced unit change in read_json_mean_clim.py should be removed as well. Otherwise, the Metrics () fuction to decode the metrics json files will return wrong variable names.
Remove forced unit conversion in read_json_mean_clim.py
Instead of passing |
@lee1043 : Hi Jiwoo, you modifications look more clearer to me. |
Current compute_metrics.py used either ".5f" or ".3f" to form the floating numbers for the output from the mean climate driver. As the magnitude of the model variable can range from 1e5 (e.g pressure ) to 1e-3 (e.g. humidity), used the ".5f" and ".3f" can sometimes truncate the small values to zero. It seems that using a standard scientific notation can be benificial in case the user processed the data without converting the unit data ahead. In this way, it also provide possibilities for users to convert the units within the diagnostic datasets.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes are made to mean_climate_driver.py to call the updated version of region_subset() function. Specifically, current mean_climate_driver.py passed three input parameters in to region_subset() to mask the data for regional mean climate calculation. However, the region_subset() in pcmdi_metrics.io library required 5 input parameters, leading to the failure of mean_climate_driver.py calculation.
The reason for the problems in mean_climate_driver.py is due to the update of the region_subset() function:
Where the three input parameters ds, regions_specs, and region are used to mask the input ds data array.
Where the input parameters and position are changed. However, associated changes in mean_climate_driver.py were not made accordingly to feel the change in regional_subset function.
In this commit, I made corrections in mean_climate_driver.py to use the new region_subset() function as mentioned above. A special note for my changes, see example below:
the "None" is always used for the variable name as I think this would be more general as it is not clear whether "varname" or "varname_in_file" should be passed to this function.