Skip to content
Snippets Groups Projects
Commit 850c5f12 authored by DanielFrisinghelli's avatar DanielFrisinghelli
Browse files

EuroCordex inventory.

parent 665de64f
No related branches found
No related tags found
No related merge requests found
"""Inventory of EuroCordex simuations."""
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# externals
import pandas as pd
# locals
from pysegcnn.core.utils import search_files
# parameters defining a Cordex climate simulation
CORDEX_PARAMETERS = ['Variable', 'Domain', 'Gcm', 'Scenario', 'Ensemble',
'Rcm', 'Version', 'Frequency', 'Years']
def get_inventory(path):
# find all netcdf files in path
inventory = search_files(path, '(.*).nc$')
# create dictionary: (filename: [simulation parameters])
inventory = {k: k.stem.split('_') for k in inventory}
# create a DataFrame
df = pd.DataFrame(data=inventory.values(), index=inventory.keys(),
columns=CORDEX_PARAMETERS)
return df
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment