-
Notifications
You must be signed in to change notification settings - Fork 12
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
[Doc]: Calculating Daily Climatology and Departures from Monthly Time Series needs to use daily input #303
Comments
https://xcdat.readthedocs.io/en/v0.3.0/examples/climatology-and-departures.html#3.4.-Daily-Cycle I think this part should also be modified using daily input data. |
@msahn Nice catch! Agreed. |
Thank you for reporting this issue @msahn.
Yeah, we did a general review of these notebooks so it would be helpful if we had a more thorough review. If @lee1043 can take a look, that would be great. |
@tomvothecoder @chengzhuzhang sure, I will take this a look. |
I am in a motion of experimenting loading daily dataset but getting below error, @tomvothecoder any chance this look familiar to you? Loading daily netcdf file: filepath2 = "http://esgf.nci.org.au/thredds/dodsC/master/CMIP6/CMIP/CSIRO/ACCESS-ESM1-5/historical/r1i1p1f1/day/tas/gn/v20191115/tas_day_ACCESS-ESM1-5_historical_r1i1p1f1_gn_20000101-20141231.nc"
ds2 = xcdat.open_dataset(filepath2)
# Unit adjust (-273.15, K to C)
ds2["tas"] = ds2.tas - 273.15
ds2 Error message:
|
I don't think this issue is related to the unit conversion or xcdat: If you open the dataset with xarray (i.e., |
When dataset file sizes are larger than the default OPeNDAP setting (usually 500mb), you have to chunk to avoid being rate limited.
Here's an explanation in another xCDAT notebook (scroll down to 3.3 Month Averages because the headers are broken): https://xcdat.readthedocs.io/en/latest/examples/temporal-average.html#3.3-Monthly-Averages-(freq= |
#277 should be explored to replace the referenced datasets in the demos, since OPeNDAP is introducing overhead with needing to chunk for larger datasets. |
@tomvothecoder @pochedls thanks for your comments. @tomvothecoder's above solution for adding After that step, I am getting another error that I suspect it is from leap year handling (see the last line of the error message, @msahn could you share us (or point to your code in PMP) for how you handle leap year when getting the daily climatology in your precipitation metric work? >> daily_climo = ds2.temporal.climatology("tas", freq="day", weighted=True) Error message:
Follow up checking: >> import cftime
>> cftime.DatetimeProlepticGregorian(0, 2, 29, 0, 0, 0, 0, has_year_zero=True) # okay (leap year every 4th year starting 0th)
>> cftime.DatetimeProlepticGregorian(1, 2, 29, 0, 0, 0, 0, has_year_zero=True) # Error (because no leap year in 1th year)
|
@msahn I think I found your code in PMP that gets daily climatology. I think you are basically stretching non-leap year days to 366 and insert missing value at 2/29 so they can be excluded when calculating daily climatology, is that correct? |
Following this, it looks like removing 2/29 of leap year prior to daily climatology calculation might be an easier way with xCDAT. # Remove leap year prior to daily climatology
ds3 = ds2.sel(time=~((ds2.time.dt.month==2)&(ds2.time.dt.day==29)))
daily_climo = ds3.temporal.climatology("tas", freq="day", weighted=True)
daily_climo.tas.shape
I am not sure if this step needs to be included in the climatology function, or just having it noted in the document should be enough. |
Yes, that is correct. In this way, I could calculate 366-day climatology including 2/29. |
Opened discussion at #332 |
Describe your documentation update
https://xcdat.readthedocs.io/en/v0.3.0/examples/climatology-and-departures.html#2.4-Daily-Cycle
I think the example calculation of daily climatology did not work properly because the input data was monthly data. It is expected that the output time steps are 365 or 366, but the example output time steps are 12.
The text was updated successfully, but these errors were encountered: