Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
5c86f3a
CLIMATE-912 Upgrade mccSearch code from Python2 > 3
lewismc Apr 26, 2017
c800e48
optimizing traversing
WIZARDELF May 30, 2017
51d9dce
Merge branch 'master' into CLIMATE-912
lewismc Aug 9, 2017
9a30e19
CLIMATE-912 Upgrade mccSearch code from Python2 > 3
lewismc Sep 11, 2017
cf4fb57
CLIMATE-922 Optimize traversing in mccSearch
lewismc Sep 11, 2017
b2c0b14
Merge branch 'master' of https://github.com/BrianWilson1/climate
lewismc Sep 11, 2017
28c9239
CLIMATE-923 ocw-parallel multicore support Python3 support
lewismc Sep 11, 2017
8217d12
CLIMATE-926 - Metadata Extractors
agoodm Sep 25, 2017
ec81037
Fix model attribute in CORDEXMetadataExtractor
agoodm Sep 25, 2017
fce7205
Merge branch 'CLIMATE-926'
Sep 25, 2017
ba93542
CLIMATE 919 - load_dataset_from_multiple_netcdf_files() does not have…
agoodm Sep 26, 2017
d868be1
Allow acronyms for CORDEX domains
agoodm Sep 26, 2017
3e66d94
Default vales for subplot grid in RCMES script
agoodm Sep 26, 2017
eacee1f
Allow acronyms for CORDEX domains
agoodm Sep 26, 2017
8168d20
Default values for filename_pattern in split file loader
agoodm Sep 26, 2017
368e696
Ignore start and end times when maximum_overlap is True
agoodm Sep 26, 2017
3539aa2
CLIMATE-925 - CORDEX Config File Template
agoodm Sep 26, 2017
cb94284
CLIMATE-928 - temporal_subset should trim edges of dataset times to e…
agoodm Sep 28, 2017
94fb8d6
Incorrect indices used for temporal subset after trimming
agoodm Sep 28, 2017
032c317
CLIMATE-930 - multiple file loader forces 2D lats and lons
agoodm Sep 29, 2017
77463b9
Update local_multiple_files tests for 1D lats and lons
agoodm Sep 29, 2017
fb02c74
CLIMATE-927 - RCMES script for running multiple evaluations
agoodm Sep 29, 2017
58d6cdf
Update plotter unit tests for _best_gridshape changes
agoodm Sep 29, 2017
e7d99b6
CLIMATE-932 - A whitespace error in running the CORDEX script
Oct 23, 2017
14b98e9
Merge branch 'CLIMATE-932'
Oct 23, 2017
73765a3
CLIMATE-931 Documentation build error - missing module
lewismc Oct 31, 2017
4f13a40
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/climate
lewismc Oct 31, 2017
4cf79f3
Merge branch 'master' into CLIMATE-931
lewismc Oct 31, 2017
6979331
CLIMATE-934 Fixed error with old Bounds constructor. Fixed error wit…
Nov 22, 2017
d41041f
CLIMATE-935 Fixed subregion examples using old style Bounds construct…
Nov 22, 2017
7d6f5ae
CLIMATE-465 Add class level documentation and Apache license to examples
Nov 26, 2017
41412ca
CLIMATE-797 Fix attribute error when dataset has no mask attribute
Nov 28, 2017
706ae2d
Merge branch 'master' into CLIMATE-797
MichaelArthurAnderson Dec 1, 2017
3e17f5c
Merge branch 'master' into CLIMATE-797
MichaelArthurAnderson Dec 1, 2017
21ec176
CLIMATE-936 - Added instructions on where to find input files for the…
Dec 1, 2017
c6d7bf7
Merge branch 'master' into CLIMATE-936
MichaelArthurAnderson Dec 1, 2017
4c52367
Merge branch 'master' into CLIMATE-936
MichaelArthurAnderson Dec 1, 2017
32ab882
Merge branch 'master' into CLIMATE-465
MichaelArthurAnderson Dec 1, 2017
da7e5a0
Merge branch 'master' into CLIMATE-465
MichaelArthurAnderson Dec 1, 2017
cc8e477
Merge branch 'master' into CLIMATE-935
MichaelArthurAnderson Dec 1, 2017
8b5de9c
Merge branch 'master' into CLIMATE-935
MichaelArthurAnderson Dec 1, 2017
2d30ef8
Fix merge conflict (CLIMATE-465)
agoodm Dec 2, 2017
8cf58f8
Merge branch 'CLIMATE-797' of https://github.com/MichaelArthurAnderso…
agoodm Dec 2, 2017
85a4e34
Merge branch 'CLIMATE-936' of https://github.com/MichaelArthurAnderso…
agoodm Dec 2, 2017
e8a2bdc
CLIMATE-940 File List Does Not Display On File Selection Due To Prope…
Jan 4, 2018
37d1f30
CLIMATE-762
Jan 4, 2018
96ac07d
CLIMATE-230 Line colors in time series cycles through too few colors
Jan 4, 2018
5220300
CLIMATE-941 Value Error When Bounds Object Is Created Without Named I…
Jan 5, 2018
bc1cd24
CLIMATE-917 Bocumentation build error with Python3
Jan 5, 2018
6b30af8
CLIMATE-625 Update draw_histogram and draw_marker_on_map documentation
Jan 5, 2018
18e3a16
CLIMATE-366 Add full temporal rebin option to UI
Jan 5, 2018
fd9ad3d
CLIMATE-942 Integer Passed To Temporal Rebin Rather Than String Throw…
Jan 5, 2018
410d8dc
CLIMATE-388 Make UI backend parameters endpoint more RESTful
Jan 5, 2018
fa2098f
CLIMATE-943 TypeError: Cannot set property uiDateValidator of undefined
Jan 6, 2018
48057f6
CLIMATE-944 Grunt Errors and Karma Errors
Jan 6, 2018
2dd6b51
CLIMATE-945 Grunt Errors On Build Task
Jan 7, 2018
c7c1aeb
CLIMATE-374 UI runEvaluation doesnt use $window or $location for resu…
Jan 7, 2018
4a64b62
CLIMATE-374 UI runEvaluation doesnt use $window or $location for resu…
Jan 7, 2018
5a632c8
CLIMATE-413 Extend browser support for ocw-ui/frontend/config/karma.c…
Jan 7, 2018
64c2a55
CIMATE-917 Bocumentation build error with Python3
Jan 8, 2018
13c6dd6
CIMATE-917 Bocumentation build error with Python3
Jan 8, 2018
6a86e25
CLIMATE-626 Update doc strings in Downscaling class
Jan 8, 2018
92b0aa3
Merge branch 'CLIMATE-940'
Jan 16, 2018
4c06b8c
Merge branch 'CLIMATE-230'
Jan 16, 2018
69bbe27
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/climate
lewismc Jan 17, 2018
b7af271
CLIMATE-946 - CORDEX script does not necessarily use correct interpre…
agoodm Jan 17, 2018
59dbe80
Merge branch 'CLIMATE-413' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
a9fbf74
Merge branch 'CLIMATE-374' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
47940c4
Merge branch 'CLIMATE-388' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
09b4729
Merge branch 'CLIMATE-366' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
e63c5f2
Merge branch 'CLIMATE-625' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
91c0065
Merge branch 'CLIMATE-917' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
96ab3ea
Merge branch 'CLIMATE-941' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
1373563
Merge branch 'CLIMATE-762' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
ac52e38
Merge branch 'master' into CLIMATE-945
MichaelArthurAnderson Jan 17, 2018
08c565d
Merge branch 'master' into CLIMATE-944
MichaelArthurAnderson Jan 17, 2018
1131112
Merge branch 'master' into CLIMATE-942
MichaelArthurAnderson Jan 17, 2018
50b9d98
Merge branch 'master' into CLIMATE-943
MichaelArthurAnderson Jan 17, 2018
d4d2eab
Merge branch 'CLIMATE-943' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
3be7da8
Merge branch 'CLIMATE-945' of https://github.com/MichaelArthurAnderso…
lewismc Jan 17, 2018
e8d8d42
Merge branch 'CLIMATE-946'
Jan 17, 2018
f7346ad
CLIMATE-353 Bounds doesnt cast input values into proper format
MichaelArthurAnderson Jan 21, 2018
8443eca
CLIMATE-353 Bounds doesnt cast input values into proper format
MichaelArthurAnderson Jan 21, 2018
c2ca575
CLIMATE-947 - Updates in cordex.py
Jan 22, 2018
9d9bda2
Merge branch 'CLIMATE-947'
Jan 22, 2018
1fd1fc4
Merge branch 'CLIMATE-947'
Jan 22, 2018
d8278e2
Merge branch 'CLIMATE-942'
Jan 22, 2018
bf1f04e
CLIMATE-826 ValueError in model_ensemble_to_rcmed.py
MichaelArthurAnderson Jan 25, 2018
1a851ff
Merge branch 'CLIMATE-826'
Feb 10, 2018
cc3b36c
CLIMATE-744 Cannot load TRMM data from RCMED
MichaelArthurAnderson Feb 12, 2018
513dcc4
Merge branch 'CLIMATE-744'
Feb 23, 2018
48a18fc
CLIMATE-316 Add ESGF Download Script to repository
MichaelArthurAnderson Feb 25, 2018
848cdb6
CLIMATE-316 Add ESGF Download Script to repository
MichaelArthurAnderson Feb 25, 2018
a4c2e52
CLIMATE-891 Make (non-ESGF and pydap) examples script python 3 compat…
MichaelArthurAnderson Mar 4, 2018
539bb8b
Merge branch 'master' into CLIMATE-891
MichaelArthurAnderson Mar 4, 2018
4807c4b
CLIMATE-938 Unify format of the time information from a netCDF file.
MichaelArthurAnderson Mar 4, 2018
38fedad
CLIMATE-938 Unify format of the time information from a netCDF file.
MichaelArthurAnderson Mar 4, 2018
5058b38
Merge branch 'CLIMATE-316' of https://github.com/MichaelArthurAnderso…
lewismc Mar 13, 2018
8e1edc8
Merge branch 'CLIMATE-938' of https://github.com/MichaelArthurAnderso…
lewismc Mar 13, 2018
ad5757d
CLIMATE-948 cleanup podaac_datasource to accomodate Podaacpy 2.1.0
lewismc Mar 14, 2018
f8b8c90
Merge branch 'master' into CLIMATE-891
MichaelArthurAnderson Mar 17, 2018
5b34294
Prepare for 1.3.0 RC
lewismc Mar 28, 2018
6aa2d7e
Prepare for 1.3.0 RC
lewismc Mar 28, 2018
5d9dfcf
Update documentation and Podaacpy example
lewismc May 8, 2018
5d980b4
CLIMATE-949 - Enlarge font size on Taylor diagrams
May 15, 2018
fd8ca98
CLIMATE-948 cleanup podaac_datasource to accomodate Podaacpy 2.1.0
lewismc Jun 4, 2018
38c240a
CLIMATE-952 - Update ocw.data_processor.write_netcdf to compatible wi…
Jun 13, 2018
aa7b8f4
Merge branch 'CLIMATE-952'
Jun 15, 2018
8a6bd20
CLIMATE-953 - Separate the module to calculate daily climatology from…
Jun 17, 2018
434752c
Merge branch 'CLIMATE-953'
Jun 17, 2018
c121f5d
CLIMATE-954 - Debug dataset_processor.subset
Jun 18, 2018
050d3ac
Merge branch 'CLIMATE-954'
Jun 18, 2018
8742ee0
CLIMATE-955 - Bugs in dataset_processor.temporal_slice
Jun 18, 2018
926f65a
Merge branch 'CLIMATE-955'
Jun 18, 2018
f4aeb8b
CLIMATE-956 - Revert the changes in run_statistical_downscaling.py
Jun 18, 2018
353bd50
Merge branch 'CLIMATE-956'
Jun 18, 2018
85fd789
Convert Readme to rst
prateekiiest Jun 18, 2018
6aeea70
Update setup.py
prateekiiest Jun 19, 2018
3a80408
Done all the changes
prateekiiest Jun 19, 2018
367ba9e
Add cython to build dependency files
lewismc Jun 26, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,73 @@
Apache Open Climate Workbench Change Log
========================================

# Release Notes - Apache Open Climate Workbench - Version 1.3.0
# Release Report - https://s.apache.org/TSNM

Sub-task

[CLIMATE-529] - Verify that Nio dependency has been removed from mccsearch

Bug

[CLIMATE-338] - RCMED data source loads datasets improperly based on day attribute of time values
[CLIMATE-353] - Bounds doesn't cast input values into proper format
[CLIMATE-374] - UI runEvaluation doesn't use $window or $location for results transition
[CLIMATE-413] - Extend browser support for ocw-ui/frontend/config/karma.conf.js
[CLIMATE-480] - plotter.draw_subregions requires outdated subregion object
[CLIMATE-744] - Cannot load TRMM data from RCMED
[CLIMATE-756] - Error: Invalid LatLng object: (NaN, NaN) when queuing APHRODITE v.1101 precipitation for the Monsoon Asia domain from RCMED
[CLIMATE-790] - SSL errors in the esgf example
[CLIMATE-797] - Attribute error in mask_missing_data
[CLIMATE-826] - ValueError in model_ensemble_to_rcmed.py
[CLIMATE-891] - Make (non-ESGF and pydap) examples script python 3 compatible
[CLIMATE-913] - Bugs in CLI
[CLIMATE-914] - Update dataset_processor.spatial_regrid module
[CLIMATE-915] - Updates for the NARCCAP example configuration files
[CLIMATE-917] - Bocumentation build error with Python3
[CLIMATE-919] - load_dataset_from_multiple_netcdf_files() does not have default variable units
[CLIMATE-922] - Optimize traversing in mccSearch
[CLIMATE-929] - Incorrect indices used for temporal subset after trimming
[CLIMATE-930] - multiple file loader forces 2D lats and lons
[CLIMATE-931] - Documentation build error - missing module
[CLIMATE-943] - TypeError: Cannot set property 'uiDateValidator' of undefined
[CLIMATE-945] - Grunt Errors On Build Task
[CLIMATE-946] - CORDEX script does not necessarily use correct interpreter when calling RCMES

Epic

[CLIMATE-924] - Changes to RCMES and ocw for CORDEX pilot project

New Feature

[CLIMATE-316] - Add ESGF Download Script to repository
[CLIMATE-366] - Add 'full' temporal rebin option to UI
[CLIMATE-426] - Create documentation for working with OCW in Eclipse
[CLIMATE-925] - CORDEX Config File Template
[CLIMATE-926] - Metadata Extractors
[CLIMATE-927] - RCMES script for running multiple evaluations

Improvement

[CLIMATE-230] - Line colors in time series cycles through too few colors
[CLIMATE-348] - Add better default naming for local files
[CLIMATE-388] - Make UI backend 'parameters' endpoint more RESTful
[CLIMATE-465] - Add class level documentation to all OCW python examples
[CLIMATE-625] - Update draw_histogram and draw_marker_on_map documentation
[CLIMATE-626] - Update doc strings in Downscaling class
[CLIMATE-863] - Address warning, deprecation, etc. within Travis-CI log output
[CLIMATE-887] - test_get_netcdf_variable_names setUp to run only once for the test case
[CLIMATE-912] - Upgrade mccSearch code from Python2 > 3
[CLIMATE-920] - Make examples Python 3 compatible
[CLIMATE-928] - temporal_subset should trim edges of dataset times to ensure months divide evenly into years
[CLIMATE-938] - Unify format of the time information from a netCDF file

Task

[CLIMATE-631] - Add documentation on ESGF credential issues
[CLIMATE-762] - Automate symlinking ocw-vm frontend to backend to allow for serving of files with bottle.
[CLIMATE-881] - Add podaacpy to ocw-conda-dependencies.txt

# Release Notes - Apache Open Climate Workbench - Version 1.2.0
# Release Report - https://s.apache.org/120release

Expand Down
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Apache Open Climate Workbench
Copyright 2014 The Apache Software Foundation
Copyright 2018 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Down
62 changes: 62 additions & 0 deletions RCMES/CORDEX/cordex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import os
import sys
import subprocess
import jinja2
from metadata_extractor import CORDEXMetadataExtractor, obs4MIPSMetadataExtractor

# These should be modified. TODO: domains can also be made into separate group
# CORDEX domain

user_input = sys.argv[1:]
if len(user_input) == 4:
domain, workdir, obs_dir, models_dir = user_input[:]
else:
domain = 'NAM-44'

# The output directory
workdir = os.getcwd()+'/'+domain+'_analysis'

# Location of osb4Mips files
obs_dir = '/proj3/data/obs4mips'

# Location of CORDEX files
models_dir = '/proj3/data/CORDEX/{domain}/*'.format(domain=domain)

# Extract metadata from model and obs files, pairing up files with the same
# variables for separate evaluations
obs_extractor = obs4MIPSMetadataExtractor(obs_dir)
models_extractor = CORDEXMetadataExtractor(models_dir)
groups = obs_extractor.group(models_extractor, 'variable')

# Configuration file template, to be rendered repeatedly for each evaluation
# run
env = jinja2.Environment(loader=jinja2.FileSystemLoader('./templates'),
trim_blocks=True, lstrip_blocks=True)
t = env.get_template('CORDEX.yaml.template')

# Each group represents a single evaluation. Repeat the evaluation for
# three seasons: Summer, Winter, and Annual.
seasons = ['annual', 'winter', 'summer']
errored = []
for group in groups:
obs_info, models_info = group
instrument = obs_info['instrument']
variable = obs_info['variable']
for season in seasons:
configfile_basename = '_'.join([domain, instrument, variable, season]) + '.yaml'
configfile_path = os.path.join(workdir, domain, instrument,
variable, season)
if not os.path.exists(configfile_path):
os.makedirs(configfile_path)
configfile_path = os.path.join(configfile_path, configfile_basename)
with open(configfile_path, 'w') as configfile:
configfile.write(t.render(obs_info=obs_info, models_info=models_info,
season=season, output_dir=workdir))

# TODO: Do this in parallel. Will change this once this approach
# is well tested.
code = subprocess.call([sys.executable, '../run_RCMES.py', configfile_path])
if code:
errored.append(configfile_path)

print("All runs done. The following ended with an error: {}".format(errored))
245 changes: 245 additions & 0 deletions RCMES/CORDEX/metadata_extractor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
import glob
import os


class MetadataExtractor(object):
def __init__(self, *paths):
"""Extracts metadata from data filenames.

Instances of MetadataExtractor are used to extract metadata from
filenames in bulk. Example usage:
>>> extractor = MetadataExtractor('/path/to/data')

Suppose the data in this directory had the following files:
pr_*.nc, uas_*.nc, vas_*.nc

All of the metadata lies in the data attribute:
>>> extractor.data
[{'filename': /path/to/data/pr_*.nc, 'variable': 'pr'},
{'filename': /path/to/data/vas_*.nc, 'variable': 'vas'},
{'filename': /path/to/data/uas_*.nc, 'variable': 'uas'}]

Results can be narrowed down by specifying values for a field:
>>> extractor.query(variable='pr')
[{'filename': /path/to/data/pr_*.nc, 'variable': 'pr'}]

Finally, metadata from two sets of extractors can be grouped together
based on common field name as follows:
>>> extractor.group(extractor2, 'variable')

This class should only be used as a starting point. We recommend using
the included obs4MIPSMetadataExtractor and CORDEXMetadataExtractor
subclasses or creating your own subclass for your usecase.
"""
self.paths = paths

@property
def data(self):
"""
The extracted metadata for each file, with all fields listed in
the fields attribute included.
"""
return self._data

@property
def paths(self):
"""
Search paths containing the dataset files.
"""
return self._paths

@paths.setter
def paths(self, paths):
"""
Extracts the metadata from scratch when paths are reset.
"""
self._paths = paths
self._extract()

@property
def fields(self):
"""
The name of field in the filename, assuming the fully filtered
filename conforms to the following convention:
filename = <field[0]>_<field[1]>_..._<field[n]>.nc. Using fewer fields
than the filename defines is allowed.
"""
fields = ['variable']
return fields

@property
def files(self):
"""
List of files (or regular expressions) for each dataset.
"""
files = []
for path in self.paths:
files.extend(glob.glob(os.path.join(path, '*.nc')))
return list(set(self.get_pattern(fname) for fname in files))

@property
def variables(self):
"""
Get the list of variables included accross all the datasets.
"""
return self.get_field('variable')

@property
def field_filters(self):
"""
Override this to filter out specific characters contained in a field.
"""
return dict()

def query(self, **kwargs):
"""
Narrow down the list of files by field names.
"""
fields = kwargs.keys()
if not set(fields).issubset(set(self.fields)):
raise ValueError("Invalid fields: {}. Must be subset of: {}"
.format(fields, self.fields))
data = self.data
for field, value in kwargs.items():
value = value if isinstance(value, list) else [value]
data = [meta for meta in data
if self._match_filter(meta, field) in value]
return data

def group(self, extractor, field):
"""
Compare the data of this extractor with another extractor instance
and group each of their metadata together by given field.
"""
# First we only want to consider values of field which are contained
# in both extractors
subset = self.get_field(field)
other_subset = extractor.get_field(field)
intersection = list(subset.intersection(other_subset))

# Next we will group the datasets in each extractor together by common
# field values
kwargs = {field: intersection}
results = self.query(**kwargs)

groups = []
for meta in results:
val = self._match_filter(meta, field)
kwargs.update({field: val})
match = extractor.query(**kwargs)
groups.append((meta, match))

return groups

def get_field(self, field):
"""
Returns only the selected field of the extracted data.
"""
if field not in self.fields:
raise ValueError("Invalid field: {}. Must be one of: {}"
.format(field, self.fields))
sub = set(meta[field] for meta in self.data)
return sub

def filter_filename(self, fname):
"""
Applies a filter to each individual filename contained in the _files
attribute, which is useful if some files within a data set are known
to not follow conventions, and "fix" them so that they do.
"""
return os.path.basename(fname)

def get_pattern(self, fname):
"""
Used to group multiple file datasets together via regular expresssions.
The most common convention is to split files by time periods, which
are generally the last field in a filename.
"""
base = fname.split('_')
pattern = '_'.join(base[:len(self.fields)] + ['*.nc'])
return pattern

def _match_filter(self, meta, field):
"""
Filter (ignore) certain character patterns when matching a field.
"""
val = meta[field]
if field in self.field_filters:
for pattern in self.field_filters[field]:
val = val.replace(pattern, '')
return val

def _extract(self):
"""
Do the actual metadata extraction from the list of filename given
via filter_filelist(). Additionally, filenames can also be filtered
via filter_filename() to remove unwanted characters from the extraction.
"""
self._data = []
for fname in self.files:
meta = dict(filename=fname)

# Perform the actual metadata extraction
fname = self.filter_filename(fname)
meta.update(dict(zip(self.fields, fname.split('_')[:-1])))
self._data.append(meta)


class obs4MIPSMetadataExtractor(MetadataExtractor):
@property
def instruments(self):
"""
Get the list of instruments accross all the datasets.
"""
return self.get_field('instrument')

@property
def fields(self):
"""
obs4MIPs fields
"""
fields = ['variable', 'instrument', 'processing_level', 'version']
return fields

@property
def field_filters(self):
"""
Field filters for CALIPSO
"""
return dict(variable=['calipso', 'Lidarsr532'])

def filter_filename(self, fname):
"""
CALIPSO files have odd naming conventions, so we will use
a modified version to conform to standard obs4MIPs conventions.
"""
fname = os.path.basename(fname)
fname = fname.replace('_obs4MIPs_', '_')
return fname

def get_pattern(self, fname):
"""
Overriden to deal with CALIPSO filenames
"""
base = fname.split('_')
offset = -2 if len(base) != 5 else -1
pattern = '_'.join(base[:offset] + ['*.nc'])
return pattern


class CORDEXMetadataExtractor(MetadataExtractor):
@property
def models(self):
"""
Get the list of models accross all the datasets.
"""
return self.get_field('model')

@property
def fields(self):
"""
obs4MIPs fields
"""
fields = ['variable', 'domain', 'driving_model', 'experiment',
'ensemble', 'model', 'version', 'time_step']
return fields
Loading