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

Monsoon Wang plots on the fly #1202

Merged
merged 2 commits into from
Dec 2, 2024
Merged

Monsoon Wang plots on the fly #1202

merged 2 commits into from
Dec 2, 2024

Conversation

lee1043
Copy link
Contributor

@lee1043 lee1043 commented Nov 28, 2024

No description provided.

@lee1043 lee1043 self-assigned this Nov 28, 2024
@lee1043 lee1043 marked this pull request as ready for review November 28, 2024 22:11
@lee1043 lee1043 requested a review from acordonez December 2, 2024 03:09
@lee1043
Copy link
Contributor Author

lee1043 commented Dec 2, 2024

@acordonez when you get a chance, could you please run demo 2a with the PR to see if it run smoothly?

@lee1043 lee1043 added this to the 3.8 milestone Dec 2, 2024
@acordonez
Copy link
Collaborator

@lee1043 I'm getting this error on the first run in Notebook 2a. I am using this branch and reran Demo 0 to regenerate the parameter files first.

>>>monsoon_wang_driver.py -p basic_monsoon_wang_param.py
/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/pcmdi_metrics/utils/string_constructor.py:43: UserWarning: Keyword 'model' not provided for filling the template.
  warnings.warn(f"Keyword '{k}' not provided for filling the template.")

modelFile =   demo_data_tmp/CMIP5_demo_clims/cmip5.historical.CanCM4.r1i1p1.mon.pr.198101-200512.AC.v20200426.nc
dom =   AllMW

Traceback (most recent call last):
  File "/home/ordonez4/miniconda3/envs/pmp_dev/bin/monsoon_wang_driver.py", line 245, in <module>
    monsoon_wang_runner(args)
  File "/home/ordonez4/miniconda3/envs/pmp_dev/bin/monsoon_wang_driver.py", line 174, in monsoon_wang_runner
    ds_out = xr.Dataset(
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/xarray/core/dataset.py", line 685, in __init__
    variables, coord_names, dims, indexes, _ = merge_data_and_coords(
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/xarray/core/dataset.py", line 416, in merge_data_and_coords
    return merge_core(
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/xarray/core/merge.py", line 719, in merge_core
    variables, out_indexes = merge_collected(
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/xarray/core/merge.py", line 290, in merge_collected
    merged_vars[name] = unique_variable(
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/xarray/core/merge.py", line 144, in unique_variable
    raise MergeError(
xarray.core.merge.MergeError: conflicting values for variable 'time' on objects to be combined. You can skip this check by specifying compat='override'.
[WARNING] yaksa: 10 leaked handle pool objects

@acordonez
Copy link
Collaborator

@lee1043 Realized I was using an old environment and needed to update xcdat. But now I am seeing this issue. I am using numpy version 2.0.2 - what version of numpy should I be testing this with?

Traceback (most recent call last):
  File "/home/ordonez4/miniconda3/envs/pmp_dev/bin/monsoon_wang_driver.py", line 10, in <module>
    import pcmdi_metrics
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/pcmdi_metrics/__init__.py", line 17, in <module>
    from . import io
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/pcmdi_metrics/io/__init__.py", line 28, in <module>
    from .region_from_file import region_from_file
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/pcmdi_metrics/io/region_from_file.py", line 4, in <module>
    import regionmask
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/regionmask/__init__.py", line 3, in <module>
    from . import core, defined_regions
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/regionmask/defined_regions/__init__.py", line 3, in <module>
    from . import _natural_earth, _ressources
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/regionmask/defined_regions/_natural_earth.py", line 14, in <module>
    from ..core.regions import Regions
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/regionmask/core/regions.py", line 15, in <module>
    from .mask import _inject_mask_docstring, _mask_2D, _mask_3D
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/regionmask/core/mask.py", line 534, in <module>
    lon, lat, polygons, numbers, fill=np.NaN, is_unstructured=False, as_3D=False
  File "/home/ordonez4/miniconda3/envs/pmp_dev/lib/python3.10/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.NaN` was removed in the NumPy 2.0 release. Use `np.nan` instead.. Did you mean: 'nan'?
[WARNING] yaksa: 10 leaked handle pool objects

@lee1043
Copy link
Contributor Author

lee1043 commented Dec 2, 2024

@acordonez thank you for testing. Can you tell what the version of regionmask is in your env?

@acordonez
Copy link
Collaborator

@lee1043 regionmask is 0.10.0

@lee1043
Copy link
Contributor Author

lee1043 commented Dec 2, 2024

@acordonez It looks like we have to use regionmask >= v0.11.0 according to regionmask/regionmask#440. Could you check if this issue continues when you update regionmask version?

@lee1043
Copy link
Contributor Author

lee1043 commented Dec 2, 2024

@acordonez In dev.yml and ci.yml, I see the dependency list that includes regionmask=0.12.1

@acordonez
Copy link
Collaborator

@lee1043 Thanks, the notebook ran for me with this fix. Is there anything in particular I should look at?

@lee1043
Copy link
Contributor Author

lee1043 commented Dec 2, 2024

@acordonez thank you for confirming! I think checking if the notebook runs okay on your end is sufficient. With that I am confident to merge this PR. Please approve it unless you find any other issues.

@lee1043 lee1043 merged commit 35696c2 into main Dec 2, 2024
4 checks passed
@lee1043 lee1043 deleted the feature/1127_monsoon branch December 2, 2024 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Online figure generation [Feature]: production of diagostics plot on the fly
2 participants