Skip to content

Commit

Permalink
migrate filepath to importlib_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-springer committed Aug 21, 2024
1 parent 08a5363 commit 2665e6b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rdtools/clearsky_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from numpy import arange
from datetime import timedelta
import pandas as pd
import pkg_resources
from contextlib import ExitStack
import numpy as np
import warnings
import importlib.resources as importlib_resources


def get_clearsky_tamb(times, latitude, longitude, window_size=40,
Expand Down Expand Up @@ -42,8 +43,9 @@ def get_clearsky_tamb(times, latitude, longitude, window_size=40,
* https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD_LSTN_CLIM_M
'''

filepath = pkg_resources.resource_filename('rdtools',
'data/temperature.hdf5')
file_manager = ExitStack()
ref = importlib_resources.files("rdtools") / "data/temperature.hdf5"
filepath = file_manager.enter_context(importlib_resources.as_file(ref))

buffer = timedelta(days=window_size)

Expand Down

0 comments on commit 2665e6b

Please sign in to comment.