def create_data_object(self, filenames, variable): from cis.data_io.netcdf import read_many_files, get_metadata coords = self._create_coord_list(filenames) data = read_many_files(filenames, variable, dim="pixel_number") metadata = get_metadata(data[variable]) return UngriddedData(data[variable], metadata, coords)
def _create_coord_list(self, filenames): from cis.data_io.netcdf import read_many_files, get_metadata from cis.data_io.Coord import Coord import datetime # FIXME: when reading an existing file variables might be "latitude", "longitude" variables = ["lat", "lon", "time"] logging.info("Listing coordinates: " + str(variables)) data = read_many_files(filenames, variables, dim="pixel_number") coords = CoordList() coords.append(Coord(data["lon"], get_metadata(data["lon"]), "X")) coords.append(Coord(data["lat"], get_metadata(data["lat"]), "Y")) time_coord = Coord(data["time"], get_metadata(data["time"]), "T") time_coord.convert_TAI_time_to_std_time(datetime.datetime(1970, 1, 1)) coords.append(time_coord) return coords