Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
files.loc[orig[0] + doff - pds.DateOffset(days=1)] = orig[1]
files = files.sort_index()
new_files.append(files.loc[orig[0]: orig[0] + doff - \
pds.DateOffset(days=1)].asfreq('D', method='pad'))
files = pds.concat(new_files, sort = True)
files = files.dropna()
files = files.sort_index()
# add the date to the filename
files = files + '_' + files.index.strftime('%Y-%m-%d')
return files
elif format_str is None:
estr = 'A directory must be passed to the loading routine for SuperMAG'
raise ValueError(estr)
else:
return pysat.Files.from_os(data_path=data_path, format_str=format_str)
code = 'L1'
desc = None
elif level == 'level_2':
code = 'L2'
desc = None
else:
raise ValueError('Unsupported level supplied: ' + level)
if format_str is None:
format_str = 'ICON_'+code+'_EUV_Daytime'
if desc is not None:
format_str += '_' + desc + '_'
format_str += '_{year:4d}-{month:02d}-{day:02d}'
format_str += '_v{version:02d}r{revision:03d}.NC'
return pysat.Files.from_os(data_path=data_path,
format_str=format_str)
supported_tags=supported_tags)
fname = 'cnofs_cindi_ivm_500ms_{year:4d}{month:02d}{day:02d}_v01.cdf'
supported_tags = {'': fname}
list_files = functools.partial(cdw.list_files,
supported_tags=supported_tags)
"""
if data_path is not None:
if format_str is None:
try:
format_str = supported_tags[sat_id][tag]
except KeyError as estr:
raise ValueError('Unknown sat_id or tag: ' + estr)
out = pysat.Files.from_os(data_path=data_path,
format_str=format_str)
if (not out.empty) and fake_daily_files_from_monthly:
out.loc[out.index[-1] + pds.DateOffset(months=1)
- pds.DateOffset(days=1)] = out.iloc[-1]
out = out.asfreq('D', 'pad')
out = out + '_' + out.index.strftime('%Y-%m-%d')
return out
return out
else:
estr = ''.join(('A directory must be passed to the loading routine ',
'for '))
raise ValueError(estr)
"""
if format_str is None:
if tag not in list(apid.keys()):
raise ValueError('unknown {:s} {:s} tag: {:s}'.format(platform,
name, tag))
if index_start_time:
time_str = '{year:4d}{month:02d}{day:02d}_??????_????????_??????'
else:
time_str = '????????_??????_{year:4d}{month:02d}{day:02d}_??????'
format_str = ''.join(('DMT_N1_{:d}_??????_'.format(apid[tag]),
time_str, '.DAT'))
return pysat.Files.from_os(data_path=data_path, format_str=format_str)
code = 'L1'
desc = None
elif level == 'level_2':
code = 'L2'
desc = None
else:
raise ValueError('Unsupported level supplied: ' + level)
if format_str is None:
format_str = 'ICON_'+code+'_FUV_Daytime-ON2'
if desc is not None:
format_str += '_' + desc + '_'
format_str += '_{year:4d}-{month:02d}-{day:02d}'
format_str += '_v{version:02d}r{revision:03d}.NC'
return pysat.Files.from_os(data_path=data_path,
format_str=format_str)
"""
if format_str is None and tag is not None:
if tag == 'north' or tag == 'south':
hemi_fmt = ''.join(('{year:4d}{month:02d}{day:02d}.', tag,
'.grdex'))
return pysat.Files.from_os(data_path=data_path,
format_str=hemi_fmt)
else:
estr = 'Unrecognized tag name for SuperDARN, north or south.'
raise ValueError(estr)
elif format_str is None:
estr = 'A tag name must be passed to SuperDARN.'
raise ValueError(estr)
else:
return pysat.Files.from_os(data_path=data_path, format_str=format_str)
this routine. However, as this is a generic routine, those definitions
can't be made here. This method could be used in an instrument specific
module where the list_files routine in the new package defines the
format_str based upon inputs, then calls this routine passing both
data_path and format_str.
Alternately, the list_files routine in methods.nasa_cdaweb may also be
used and has more built in functionality. Supported tages and format
strings may be defined within the new instrument module and passed as
arguments to methods.nasa_cdaweb.list_files . For an example on using
this routine, see pysat/instrument/cnofs_ivm.py or cnofs_vefi, cnofs_plp,
omni_hro, timed_see, etc.
"""
return pysat.Files.from_os(data_path=data_path, format_str=format_str)
code = 'L2'
desc = None
else:
raise ValueError('Unsupported level supplied: ' + level)
# deal with case of sat_id
satid = sat_id.capitalize()
if format_str is None:
format_str = 'ICON_'+code+'_MIGHTI_Vector-Wind-'+satid
if desc is not None:
format_str += '_' + desc + '_'
format_str += '_{year:4d}-{month:02d}-{day:02d}'
format_str += '_v{version:02d}r{revision:03d}.NC'
return pysat.Files.from_os(data_path=data_path,
format_str=format_str)
----
The returned Series should not have any duplicate datetimes. If there are
multiple versions of a file the most recent version should be kept and the
rest discarded. This routine uses the pysat.Files.from_os constructor, thus
the returned files are up to pysat specifications.
Multiple data levels may be supported via the 'tag' input string.
Multiple instruments via the sat_id string.
"""
format_str = 'example_name_{year:04d}_{month:02d}_{day:02d}.nc'
# we use a pysat provided function to grab list of files from the
# local file system that match the format defined above
return pysat.Files.from_os(data_path=data_path, format_str=format_str)
'v{version:02d}r{revision:04d}.NC'
Note
----
The returned Series should not have any duplicate datetimes. If there are
multiple versions of a file the most recent version should be kept and the
rest discarded. This routine uses the pysat.Files.from_os constructor, thus
the returned files are up to pysat specifications.
"""
if format_str is None:
# default file naming
format_str = 'tiegcm_icon_merg2.0_totTgcm.s_{day:03d}_{year:4d}.nc'
return pysat.Files.from_os(data_path=data_path, format_str=format_str)