-
Notifications
You must be signed in to change notification settings - Fork 40
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
Extremes Metrics #962
Extremes Metrics #962
Conversation
# Revision by MFW 08/10/2018: Removed the 4 seasons for speed. Added some comments
Update make_extrema_longrun_3day.py
…com/PCMDI/pcmdi_metrics into 534_pjg_mfw_extremes
@lee1043 I think the new push should fix this error |
@acordonez thank you for the fix, it resolved the error. However there is a new error as below, do you have an idea?
|
@lee1043 At this point the obs dataset should have bounds because the last change I made was to move the call to add_missing_bounds() into the obs preprocessing section of compute_metrics. So I need to see if this is a data issue or a code issue. |
@acordonez I think this reminds me that I have seen a similar issue which was occurred by regrid2 of xcdat was dropping bounds information after interpolating. I cannot recall this issue was reported to the xcdat team, if not, I will report it. During the mean time, I think a workaround could be after the regrid2 interpolation, apply add_missing_bounds, to re-add bounds information. |
@acordonez I have to retracrt my above comment because it seems it might not be the case for this error, because the error was coming from here: obs_m = obs_dict[m].regridder.horizontal(
season, target, tool="regrid2"
) Could you check if |
@lee1043 I think I see the issue, there is a second function that would need the add_missing_bounds call. But I'm seeing if there's somewhere in the driver I can put it so I'm not adding bounds to the same dataset over and over. |
@lee1043 I did some more digging and obs_dict[m] definitely has bounds. This screenshot shows the outputs of some print statements before line 565 when the code fails. The dataset has the lat_bnds, lon_bnds, and time_bnds variables, and lat, lon, and time all have the bounds attribute. Along with that, the input dataset definitely has bounds, and earlier in the code I explicitly check for missing bounds. So I'm stumped why this call is failing. |
@lee1043 In the error message it looks like maybe it's the target grid that's missing bounds? |
That could be, as the error was coming from the line with |
@lee1043 I added bounds to the target grid and am still seeing the issue. I'll work on an example for an issue. |
Actually adding bounds to the target might have fixed the issue, I think I'm seeing an error in a different part of the code now. |
@lee1043 Sorry for all the back-and-for but this new change adds bounds to the target grid for regridding, and works on my end. |
@acordonez thank you for the fix. The code runs without the error, but the output json does not look right. Thank you for patiently addressing these issues!
import os
import json
output_path = os.path.join(demo_output_directory, "extremes_ex1/GISS-E2-H_block_extremes_metrics.json")
with open(output_path) as f:
metric = json.load(f)["RESULTS"]
print(json.dumps(metric, indent=2))
And maybe related on this, it seems below error is coming from plotting.
|
@lee1043 This latest commit fixed the all-Nan issue you flagged on my end. The notebook ran all the way for me and I'm hoping it runs for you! |
Extremes Metrics
See the README for more details.
The Github.io documentation will be updated in a second PR (#990).
This PR contains:
The extremes driver and library code
Jupyter notebook demo
The demo (Notebook #8) uses precipitation data that is already distributed as part of the demo data bundle, but processes it to make a lower resolution version that runs much more quickly. At the original resolution, it takes me around an hour to run each example.
Dependency note: This code also requires adding the "numdifftools" package as a dependency (this is available on conda-forge).