Commit a01a3491 authored by thopri's avatar thopri
Browse files

removed directory function calls from factory.py

parent 05683532
This diff is collapsed.
......@@ -18,8 +18,8 @@ def write_data_to_file(filename, variable_name, data):
ncid = Dataset(filename, 'a', clobber=False, format='NETCDF4')
count = data.shape
three_dim_variables = ['votemper', 'vosaline', 'N1p', 'N3n', 'N5s','thetao','so','uo','vo','vobtcrtx','vozocrtx','vobtcrty','vomecrty']
two_dim_variables = ['sossheig', 'iicethic', 'ileadfra', 'isnowthi','zos']
three_dim_variables = ['votemper', 'vosaline', 'N1p', 'N3n', 'N5s','vobtcrtx','vozocrtx','vobtcrty','vomecrty']
two_dim_variables = ['sossheig', 'iicethic', 'ileadfra', 'isnowthi']
if variable_name in three_dim_variables:
if len(count) == 3:
......
'''
This is an abstraction for the data repository
@author: Mr. Srikanth Nagella
NOTE: this script is no longer used/supported by PyNEMO, reading directories for data files requires an NCML file.
'''
from os import listdir
import numpy as np
......
......@@ -9,7 +9,7 @@ import os
#Local Imports
from pynemo.reader.ncml import Reader as NcMLReader
from pynemo.reader.ncml import NcMLFile
from pynemo.reader.directory import Reader as DirectoryReader
#from pynemo.reader.directory import Reader as DirectoryReader
import logging
from netCDF4 import Dataset
......@@ -20,14 +20,19 @@ def GetReader(uri, t_adjust, reader_type=None):
if uri.endswith(".ncml"):
reader_type = "NcML"
elif os.path.isdir(uri):
reader_type = "Directory"
# directory reading directly is no longer supported please use NCML file to define directory
#reader_type = "Directory"
logger.error("Directory Reading is no longer supported without using NCML file to define location")
raise Exception("Directory Reading is no longer supported without using NCML file to define location")
else:
print("Error input should be a NcML file or URL or a Local directory")
return None
logger.error("Error input: should be a NcML file")
raise Exception("Error input: should be a NcML file")
if reader_type == "NcML":
return NcMLReader(uri,t_adjust)
else:
return DirectoryReader(uri, t_adjust)
logger.error("Directory Reading is no longer supported without using NCML file to define location")
raise Exception("Directory Reading is no longer supported without using NCML file to define location")
#return DirectoryReader(uri, t_adjust)
class NetCDFFile(object):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment