Skip to content

Commit ce9845f

Browse files
authored
Merge pull request #83 from jgieseler/main
add jupyterhub_data_path
2 parents 364d843 + 16c4035 commit ce9845f

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

seppy/loader/psp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ def psp_isois_load(dataset, startdate, enddate, epilo_channel='F', epilo_thresho
199199
Name of PSP dataset:
200200
- 'PSP_ISOIS-EPIHI_L2-HET-RATES60'
201201
- 'PSP_ISOIS-EPIHI_L2-HET-RATES3600' (higher coverage than 'RATES60' before mid-2021)
202-
- 'PSP_ISOIS-EPIHI_L2-LET1-RATES60' (not yet supported)
203-
- 'PSP_ISOIS-EPIHI_L2-LET2-RATES60' (not yet supported)
202+
- 'PSP_ISOIS-EPIHI_L2-LET1-RATES60'
203+
- 'PSP_ISOIS-EPIHI_L2-LET2-RATES60'
204204
- 'PSP_ISOIS-EPILO_L2-PE'
205205
- 'PSP_ISOIS-EPILO_L2-IC'
206206
startdate, enddate : {datetime or str}

seppy/util/__init__.py

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
import datetime
3+
import psutil
34
import warnings
45

56
import astropy.constants as const
@@ -429,3 +430,14 @@ def intensity2vsd(species, kinetic_energy, intensity):
429430
p = energy2momentum(species, kinetic_energy)
430431
f = intensity / (p**2) * mass_dict[species]**3
431432
return f.to(u.s**3/(u.sr*u.cm**6))
433+
434+
435+
def jupyterhub_data_path(path_org, path_hub='/home/jovyan/data'):
436+
"""
437+
Checks if Notebook is run within SOLER/SERPENTINE JupyterHub. Returns the path of a common data folder if yes, and the original path if not.
438+
"""
439+
if (psutil.Process().parent().name() == 'jupyterhub-sing') and all(x in psutil.Process().parent().environ()['PYTHONPATH'] for x in ['/home/jovyan/serpentine/', '/home/jovyan/soler/sep_tools/']):
440+
print(f"JupyterHub detected. Adjusting data path to {path_hub}")
441+
return path_hub
442+
else:
443+
return path_org

seppy/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
)
1515
del warnings
1616

17-
version = '0.2.0'
17+
version = '0.2.1'

0 commit comments

Comments
 (0)