COVID-Weather / covid-environmental-factors

Analysis of COVID19 infection rates and their environmental conditions
GNU General Public License v3.0
4 stars 2 forks source link

Mara freilich/master #19

Closed hdrake closed 4 years ago

review-notebook-app[bot] commented 4 years ago

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

hdrake commented 4 years ago

@mara-freilich, I just altered the file paths to be consistent with my recent changes to master and also fixed up the time selection so it's not just hard coded for 2020. Thanks for the contribution!

The relevant code:

        add_days = np.arange(((tmp['End day'] - tmp['Start day'])/datetime.timedelta(days=1)).item())
        dates = [tmp['Start day'].item() + datetime.timedelta(days=add_day) for add_day in add_days]
        if np.isnan(meansp.sel(time=dates).values.mean()):
            localsp = ds['q2m'].sel(latitude=tmp['Latitude'], longitude=tmp['Longitude'], method='nearest')
            q2m_li.append(localsp.sel(time=dates).mean().values)
        else:
            q2m_li.append(meansp.sel(time=dates).mean().values)