Yes. CDD is the longest consecutive dry days, whereas DSL is the duration of the dry season, which implies you detect the start and end of the dry season based on some criteria and the length becomes the interval between it's onset and cessation. Hope this helps.
Thank you. I appreciate your comment. I built this function to calculate the DSL; please take a look. def dry_season_length(data_array, thresh=1): if len(data_array) == 0: return 0 dry_season_lengths = [] dry_season_start = None for i, value in enumerate(data_array): if value < thresh and dry_season_start is None: dry_season_start = i elif value >= thresh and dry_season_start is not None: dry_season_lengths.append(i - dry_season_start) dry_season_start = None if dry_season_start is not None: dry_season_lengths.append(len(data_array) - dry_season_start) return max(dry_season_lengths) if dry_season_lengths else 0 @@meteodata
This is great! Thank you so much, did youre for loope to run through the arange take a long time? I am using 1901-2021 CRU data for precip and it has taken long hours.
@@Dabblez Exactly. Since it is a global dataset and the loop is on each grid (which would be affected by the grid sizes), it will take some time. An obvious alternative is to parse the inputs as a DataFrame and apply the function on the entire DataFrame which could save some time. We hope to put something together on that soon. Best wishes.
Excellent work. Thanks a lot.
Perfect! Thank you so much. Very explanatory and easy to comprehend.
Glad it is helpful.
This is great. One of the programming vlogs with clear speech and clarity when teaching. Thank you Doc.
Glad it was helpful!
Thanks Dr. Aryee
Glad it's helpful.
thanks its very clear
Glad it helped
lovely videos Could you please collect chirp data and analyze rainfall extremes and rainy days. Thank you very much
Good stuffs
Thanks. Glad it's helpful.
thank you so much, is there any different between CDD and DSL (dry season length)? if yes how can i calculate the DSL?
Yes. CDD is the longest consecutive dry days, whereas DSL is the duration of the dry season, which implies you detect the start and end of the dry season based on some criteria and the length becomes the interval between it's onset and cessation. Hope this helps.
Thank you. I appreciate your comment. I built this function to calculate the DSL; please take a look.
def dry_season_length(data_array, thresh=1):
if len(data_array) == 0:
return 0
dry_season_lengths = []
dry_season_start = None
for i, value in enumerate(data_array):
if value < thresh and dry_season_start is None:
dry_season_start = i
elif value >= thresh and dry_season_start is not None:
dry_season_lengths.append(i - dry_season_start)
dry_season_start = None
if dry_season_start is not None:
dry_season_lengths.append(len(data_array) - dry_season_start)
return max(dry_season_lengths) if dry_season_lengths else 0
@@meteodata
Hey I have an idea, can I use da.where(da>thresh).count('time') to calculate the num of cwd
This is great! Thank you so much, did youre for loope to run through the arange take a long time? I am using 1901-2021 CRU data for precip and it has taken long hours.
Are you executing that on a global dataset?
@@meteodata I am yes
@@Dabblez Exactly. Since it is a global dataset and the loop is on each grid (which would be affected by the grid sizes), it will take some time.
An obvious alternative is to parse the inputs as a DataFrame and apply the function on the entire DataFrame which could save some time.
We hope to put something together on that soon. Best wishes.