SEE-GEO / ccic_climate_record_analysis

Analysis of the CCIC climate record
0 stars 1 forks source link

CCIC CPCIR time series #17

Closed adriaat closed 7 months ago

adriaat commented 7 months ago

Code to compute CCIC CPCIR time series

The results are saved in /scratch/ccic_record/data/ccic/cpcir/ccic_cpcir_1998-2023_monthlymeans.nc

elliemay481 commented 7 months ago

Looks good, and the script runs as expected.

Just curious about one thing - you (and Simon) replace NaNs with 0, I assume because cases of tiwp=0 or ca=0 are stored as NaN. But how do you differentiate between cases of tiwp=0 and actual invalid observations, to avoid counting invalid observations as clearsky cases within your means? Or is this already handled before you load the data?

adriaat commented 7 months ago

The mean is computed by dividing the summation by the total number of valid cases. If not clear, here's a simple example:

a = [0, 1, np.nan, 2]
valid = np.isfinite(a).astype(float).sum() # 3
a_0 = [0, 1, 0, 2]
a_mean = sum(a_0) / valid # 1, which is expected when NaN is ignored

The same argument also applies when weights are used.

elliemay481 commented 7 months ago

I see. I misunderstood the data a little. I assumed that cases of tiwp=0 were stored as NaN (as they are for modis). Now I understand that only invalid cases are NaN. Thank you!

I will approve the pull request now.