Skip to content

Commit

Permalink
comment cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
acordonez committed Aug 5, 2024
1 parent 5e64f15 commit b29f8fa
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pcmdi_metrics/drcdm/lib/compute_metrics.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env python
import datetime

import cftime
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
import xcdat as xc
import xclim

from pcmdi_metrics.stats import compute_statistics_dataset as pmp_stats

# import xclim


bgclr = [0.45, 0.45, 0.45]


Expand Down Expand Up @@ -1070,6 +1071,7 @@ def get_annual_pxx(
):
varname = "pr"
index = "annual_pxx"
print("Metric:", index)

# Get annual max precipitation
PR = TimeSeriesData(ds, varname)
Expand Down Expand Up @@ -1104,18 +1106,20 @@ def get_annual_pxx(
return result_dict


"""
def get_annual_cwd(
ds, sftlf, dec_mode, drop_incomplete_djf, annual_strict, fig_file=None, nc_file=None
):
index = "annual_cwd"
print("Metric:", index)
# Get annual max precipitation
ds["pr"] = ds["pr"].where(sftlf.sftlf >= 0.5).where(sftlf.sftlf <= 1)
Pcwd = xr.Dataset()
Pcwd["ANN"] = xclim.indices.maximum_consecutive_wet_days(
ds.pr, thresh="1 mm/day", freq="YS", resample_before_rl=True
)
Pcwd["time"].encoding["calendar"] = ds.time.encoding["calendar"]
Pcwd["time"].encoding["calendar"] = ds.time["calendar"]
Pcwd = update_nc_attrs(Pcwd, dec_mode, drop_incomplete_djf, annual_strict)
result_dict = metrics_json({index: Pcwd}, obs_dict={}, region="land", regrid=False)
Expand All @@ -1135,6 +1139,7 @@ def get_annual_cwd(
del Pcwd
return result_dict
"""


# A couple of statistics that aren't being loaded from mean_climate
Expand Down

0 comments on commit b29f8fa

Please sign in to comment.