Open jerabaul29 opened 1 year ago
Yes, documentation is totally lacking here, but add_readers_from_file
is supposed to take in a plain text file (from local disk) where each line is either a filename or a thredds URL to datasets. Thus its implementation is very basic:
def add_readers_from_file(self, filename, timeout=10, lazy=True):
fp = open(filename, 'r')
sources = fp.readlines()
sources = [line.strip() for line in sources if line[0] != '#']
self.add_readers_from_list(sources, timeout, lazy=lazy)
Documentation should be added, but anyway we might need to do an update, as it might generally be necessry to provide additional information to a single URL/filename, e.g. specifying which variable names to be used in cases where several variables have the same standard_name (e.g. commonly for wind, which can be at several levels, e.g. surface, tropopause....) Thus we are considering that a file could be e.g. yml or json, but also accepting plain text files as presently.
From https://opendrift.github.io/tutorial.html:
and there is not much more information available in the api description:
https://opendrift.github.io/autoapi/opendrift/models/basemodel/index.html#opendrift.models.basemodel.OpenDriftSimulation.add_readers_from_file
But:
So the
add_readers_from_file
seem to accept only local files, not "opendap url files" if I understand correctly? Could the tutorial be updated to:If I am misunderstanding something, apologies - but may be useful to clarify a bit :) .
Also, any reason for providing
add_readers_from_file
whenadd_readers_from_list
seems to be a drop in replacement with more built in capabilities? :)