def create_grd_objects(self): # NO EDIT BELOW ============================================================================================== if self.compile_all is True: import compile compile.compileallgfortran() if self.create_atmos_forcing or self.create_ocean_forcing: if self.use_esmf: try: import ESMF except ImportError: raise ImportError("Unable to import ESMF") logging.info('[M2R_configRunM2R] Starting logfile for ESMF') ESMF.Manager(debug=True) # Create the grid object for the output grid self.grdROMS = grd.Grd("ROMS", self) self.grdROMS.nlevels = self.nlevels self.grdROMS.vstretching = self.vstretching self.grdROMS.vtransform = self.vtransform self.grdROMS.theta_s = self.theta_s self.grdROMS.theta_b = self.theta_b self.grdROMS.tcline = self.tcline self.grdROMS.hc = self.hc self.grdROMS.lonname = 'lon_rho' self.grdROMS.latname = 'lat_rho' self.grdROMS.create_object(self, self.roms_grid_path) self.grdROMS.getdims() # Create the grid object for the input grid self.grdMODEL = grd.Grd("FORCINGDATA", self) self.grdMODEL.grdType = self.grd_type self.grdMODEL.lonName = self.lon_name self.grdMODEL.latName = self.lat_name self.grdMODEL.depthName = self.depth_name self.grdMODEL.fillval = self.fillvaluein
def __init__(self): print('\n--------------------------\n') print('Started ' + time.ctime(time.time())) # EDIT =================================================================== # Set show_progress to "False" if you do not want to see the progress # indicator for horizontal interpolation. self.showprogress = True # Set compileAll to True if you want automatic re-compilation of all the # fortran files necessary to run model2roms. Options are "gfortran" or "ifort". Edit # compile.py to add other Fortran compilers. self.compileall = False # Extract time-series of data for given longitude/latitude self.extractstations = False # Define a set of longitude/latitude positions with names to extract into # station files (using extractStations) if self.extractstations: # stationNames = ['NorthSea', 'Iceland', 'EastandWestGreenland', 'Lofoten', 'Georges Bank'] # lonlist = [2.4301, -22.6001, -47.0801, 13.3801, -67.2001] # latlist = [54.5601, 63.7010, 60.4201, 67.5001, 41.6423] self.stationnames = ["Ytre Utsira", "Indre Utsira", "Lista"] self.latlist = [59.316667, 59.316667, 58.016667] self.lonliost = [4.800000, 4.983333, 6.533333] # Create the bry, init, and clim files for a given grid and input data self.createoceanforcing = True # Create atmospheric forcing for the given grid self.createatmosforcing = False # currently in beta stages and unavailable # Create a smaller resolution grid based on your original. Decimates every second for # each time run self.decimategridfile = False # Write ice values to file (for Arctic regions) self.writeice = True # Use ESMF for the interpolation. This requires that you have ESMF and ESMPy installed (import ESMF) self.useesmf = True # Apply filter to smooth the 2D fields after interpolation (time consuming but enhances results) self.usefilter = True # Format to write the ouput to: 'NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', or 'NETCDF3_CLASSIC' # Using NETCDF4 automatically turns on compression of files (ZLIB) self.myformat = 'NETCDF4' self.myzlib = True # Frequency of the input data: usually monthly self.timefrequencyofinputdata = "month" # , "month", "hour" # IN GRIDTYPES ------------------------------------------------------------------------------ # Define what grid type you wnat to interpolate from (input MODEL data) # Options: # 1. SODA, 2. SODAMONTHLY, 3.WOAMONTHLY, 4. NORESM, 4. GLORYS, 5. SODA3 self.indatatype = 'SODA3' # Define what grid type you wnat to interpolate from: Can be Z for SIGMA for ROMS # vertical coordinate system or ZLEVEL. also define the name of the dimensions in the input files. # Options: # 1. SIGMA (not prpoerly implemented yet), 2. ZLEVEL self.ingridtype = "SIGMA" # Define the names of ythe geographical variables in the input files self.grdType = 'regular' self.lonName = "longitude" self.latName = "latitude" self.depthName = "depth" self.fill_value = -1.e+20 # OUT GRIDTYPES ------------------------------------------------------------------------------ # Define what grid type you wnat to interpolate to # Options: This is just the name of your grid used to identify your selection later self.outgrid = "ROHO800" self.outgridtype = "ROMS" # Subset input data. If you have global data you may want to seubset these to speed up reading. Make # sure that your input data are cartesian (0-360 or -180:180, -90:90) self.subsetindata = False if self.subsetindata: self.subset = self.definesubsetforindata() # Define nmber of output depth levels self.nlevels = 40 # Define the grid stretching properties (leave default if uncertain what to pick) self.vstretching = 4 self.vtransform = 2 self.theta_s = 7.0 self.theta_b = 0.1 self.tcline = 250.0 self.hc = 250 # PATH TO FORCINGDATA -------------------------------------------------------------------- # Define the path to the input data self.modelpath = self.defineforcingdatapath() print("model path ", self.modelpath) # PATH TO GRID ----------------------------------------------------------------------------- # Define the path to the grid file self.romsgridpath = self.defineromsgridpath() # Climatology is only monthly and model2roms needs to know this self.isclimatology = True if self.indatatype == 'WOAMONTHLY' else False # DATE AND TIME DETAILS --------------------------------------------------------- # Define the period to create forcing for self.start_year = 2013 self.end_year = 2013 self.start_month = 1 self.end_month = 12 self.start_day = 1 self.end_day = 1 if int(calendar.monthrange(self.start_year, self.start_month)[1]) < self.start_day: self.start_day = int( calendar.monthrange(self.start_year, self.start_month)[1]) if int(calendar.monthrange(self.end_year, self.end_month)[1]) < self.end_day: self.end_day = int( calendar.monthrange(self.end_year, self.end_month)[1]) print "hello, startdate here" self.startdate = datetime(self.start_year, self.start_month, self.start_day) self.enddate = datetime(self.end_year, self.end_month, self.end_day) self.years = [ self.start_year + year for year in range(self.end_year + 1 - self.start_year) ] # DEFINE VARIABLE NAMES --------------------------------------------------------- # Define what and name of variables to include in the forcing files # -> myvars is the name model2roms uses to identify variables # -> varNames is the name of the variable found in the NetCDF input files self.globalvarnames = self.defineglobalvarnames() self.inputdatavarnames = self.defineinputdatavarnames() # NO EDIT BELOW ==================================================================================================== if self.compileall is True: import compile compile.compileallgfortran() if self.createatmosforcing or self.createoceanforcing: self.abbreviation = self.defineabbreviation() self.climname, self.initname, self.bryname = self.defineoutputfilenames( ) if self.isclimatology is True: self.climname = self.abbreviation + '_' + str( self.indatatype) + '_climatology.nc' self.showinfo() if self.useesmf: import ESMF print("Starting logfile for ESMF") manager = ESMF.Manager(debug=True) # Create the grid object for the output grid self.grdROMS = grd.Grd("ROMS", self.outgridtype, self.useesmf, 'ocean', self.outgrid) self.grdROMS.Nlevels = self.nlevels self.grdROMS.vstretching = self.vstretching self.grdROMS.vtransform = self.vtransform self.grdROMS.theta_s = self.theta_s self.grdROMS.theta_b = self.theta_b self.grdROMS.Tcline = self.tcline self.grdROMS.hc = self.hc self.grdROMS.vars = self.inputdatavarnames self.grdROMS.varNames = self.globalvarnames self.grdROMS.lonName = 'lon_rho' self.grdROMS.latName = 'lat_rho' self.grdROMS.openNetCDF(self.romsgridpath) self.grdROMS.createObject() self.grdROMS.getDims() # Create the grid object for the input grid self.grdMODEL = grd.Grd("FORCINGDATA", self.outgridtype, self.useesmf, 'ocean', self.outgrid) self.grdMODEL.grdType = self.grdType self.grdMODEL.lonName = self.lonName self.grdMODEL.latName = self.latName self.grdMODEL.depthName = self.depthName self.grdMODEL.fill_value = self.fill_value #if self.createoceanforcing: # model2roms.convertMODEL2ROMS() # clim2bry.writeBry(grdROMS, start_year, bryName, climname, writeice, indatatype, myformat) #if self.createAtmosForcing: # atmosForcing.createAtmosFileUV(grdROMS, modelpath, atmospath, startdate, enddate, useESMF, # myformat, abbreviation, indatatype, gridtype, show_progress) if self.decimategridfile: decimateGrid.createGrid( grdROMS, "/Users/trondkr/Projects/KINO/GRID/kino_1600m_18072015.nc", "/Users/trondkr/Projects/KINO/GRID/kino_1600m_18072015v2.nc", 2) if self.extractstations: print( "Running in station mode and extracting pre-defined station locations" ) IOstation.getStationData(years, IDS, modelpath, latlist, lonlist, stationNames) print('Finished ' + time.ctime(time.time()))
def __init__(self): print('\n--------------------------\n') print('Started ' + time.ctime(time.time())) os.environ['WRAP_STDERR'] = 'true' # EDIT =================================================================== # Set showprogress to "False" if you do not want to see the progress # indicator for horizontal interpolation. self.showprogress = True # Set compileAll to True if you want automatic re-compilation of all the # fortran files necessary to run model2roms. Options are "gfortran" or "ifort". Edit # compile.py to add other Fortran compilers. self.compileall = False # Extract time-series of data for given longitude/latitude self.extractstations = False # Define a set of longitude/latitude positions with names to extract into # station files (using extractStations) if self.extractstations: # stationNames = ['NorthSea', 'Iceland', 'EastandWestGreenland', 'Lofoten', 'Georges Bank'] # lonlist = [2.4301, -22.6001, -47.0801, 13.3801, -67.2001] # latlist = [54.5601, 63.7010, 60.4201, 67.5001, 41.6423] self.stationnames = ["Ytre Utsira", "Indre Utsira", "Lista"] self.latlist = [59.316667, 59.316667, 58.016667] self.lonlist = [4.800000, 4.983333, 6.533333] self.numberofpoints = 4 # Number of points around lat/lon to extract and average as output # Create the bry, init, and clim files for a given grid and input data self.createoceanforcing = True # Create atmospheric forcing for the given grid self.createatmosforcing = False # currently in beta stages # Create a smaller resolution grid based on your original. Decimates every second for # each time run self.decimategridfile = False # Write ice values to file (for Arctic regions) self.writeice = True # Write biogeochemistry values to file self.writebcg = False # ROMS sometimes requires input of ice and ssh, but if you dont have these write zero files to file self.set2DvarsToZero = True # Use ESMF for the interpolation. This requires that you have ESMF and ESMPy installed (import ESMF) self.useesmf = True # Apply filter to smooth the 2D fields after interpolation (time consuming but enhances results) self.usefilter = True # Format to write the ouput to: 'NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', or 'NETCDF3_CLASSIC' # Using NETCDF4 automatically turns on compression of files (ZLIB) self.myformat = 'NETCDF4' self.myzlib = True # Frequency of the input data: usually monthly self.timefrequencyofinputdata = "5days" # , "month", "hour", "5days" # IN GRIDTYPES ------------------------------------------------------------------------------ # Define what grid type you wnat to interpolate from (input MODEL data) # Options: # 1. SODA, 2. SODAMONTHLY, 3.WOAMONTHLY, 4. NORESM, 4. GLORYS, 5. SODA3, 6. SODA3_5DAY self.ocean_indata_type = 'SODA3_5DAY' self.atmosindatatype = 'ERA5' # Define contact info for final NetCDF files self.authorname = "Trond Kristiansen" self.authoremail = "trond.kristiansen (at) niva.no" # Define what grid type you wnat to interpolate from: Can be Z for SIGMA for ROMS # vertical coordinate system or ZLEVEL. also define the name of the dimensions in the input files. # Options: # 1. SIGMA (not properly implemented yet), 2. ZLEVEL self.ingridtype = "ZLEVEL" # Define the names of the geographical variables in the input files. These may # differ depending how the variable is located in a grid (e.g. Arakawa C grid - ROMS). In # SODA 3.3.1 the u and v location is defined by xu_ocean, yu_ocean while temperature is # located in xt_ocean, yt_ocean. self.grdtype = 'regular' self.lonname = "longitude" self.latname = "latitude" self.depthname = "depth" self.lonname_u = "longitude" self.latname_u = "latitude" self.lonname_v = "longitude" self.latname_v = "latitude" if self.ocean_indata_type == 'SODA3_5DAY': self.lonname = "xt_ocean" self.latname = "yt_ocean" self.depthname = "st_ocean" self.lonname_u = "xu_ocean" self.latname_u = "yu_ocean" self.lonname_v = "xu_ocean" self.latname_v = "yu_ocean" self.timeobject = [] self.timename = "time" self.realm = "ocean" self.fillvaluein = -1.e20 # OUT GRIDTYPES ------------------------------------------------------------------------------ # Define what grid type you want to interpolate to # Options: This is just the name of your grid used to identify your selection later self.outgrid = 'ROHO800' # "ROHO800", "A20" self.outgridtype = "ROMS" # Subset input data. If you have global data you may want to seubset these to speed up reading. Make # sure that your input data are cartesian (0-360 or -180:180, -90:90) self.subset_indata = False if self.subset_indata: self.subset = self.definesubsetforindata() # Define nmber of output depth levels self.nlevels = 40 # Define the grid stretching properties (leave default if uncertain what to pick) self.vstretching = 4 self.vtransform = 2 self.theta_s = 7.0 self.theta_b = 0.1 self.tcline = 250.0 self.hc = 250 # PATH TO FORCING DATA -------------------------------------------------------------------- # Define the path to the input data self.modelpath = self.define_ocean_forcing_data_path() self.atmosphericpath = self.define_atmospheric_forcing_path() # PATH TO GRID ----------------------------------------------------------------------------- # Define the path to the grid file self.romsgridpath = self.define_roms_grid_path() # Climatology is only monthly and model2roms needs to know this self.isclimatology = True if self.ocean_indata_type == 'WOAMONTHLY' else False # DATE AND TIME DETAILS --------------------------------------------------------- # Define the period to create forcing for self.start_year = 2002 self.end_year = 2003 self.start_month = 5 self.end_month = 12 self.start_day = 15 self.end_day = 31 if int(calendar.monthrange(self.start_year, self.start_month)[1]) < self.start_day: self.start_day = int( calendar.monthrange(self.start_year, self.start_month)[1]) if int(calendar.monthrange(self.end_year, self.end_month)[1]) < self.end_day: self.end_day = int( calendar.monthrange(self.end_year, self.end_month)[1]) self.startdate = datetime(self.start_year, self.start_month, self.start_day) self.enddate = datetime(self.end_year, self.end_month, self.end_day) self.years = [ self.start_year + year for year in range(self.end_year + 1 - self.start_year) ] # DEFINE VARIABLE NAMES --------------------------------------------------------- # Define what and name of variables to include in the forcing files # -> myvars is the name model2roms uses to identify variables # -> varNames is the name of the variable found in the NetCDF input files self.globalvarnames = self.define_global_varnames() self.inputdatavarnames = self.define_input_data_varnames() # NO EDIT BELOW ==================================================================================================== if self.compileall is True: import compile compile.compileallgfortran() if self.createatmosforcing or self.createoceanforcing: self.abbreviation = self.define_abbreviation() self.clim_name, self.init_name, self.bry_name = self.define_output_filenames( ) if self.isclimatology is True: self.clim_name = self.abbreviation + '_' + str( self.ocean_indata_type) + '_climatology.nc' self.showinfo() if self.useesmf: try: import ESMF except ImportError: raise ImportError("Unable to import ESMF") print("Starting logfile for ESMF") ESMF.Manager(debug=True) # Create the grid object for the output grid self.grdROMS = grd.Grd("ROMS", self) self.grdROMS.nlevels = self.nlevels self.grdROMS.vstretching = self.vstretching self.grdROMS.vtransform = self.vtransform self.grdROMS.theta_s = self.theta_s self.grdROMS.theta_b = self.theta_b self.grdROMS.tcline = self.tcline self.grdROMS.hc = self.hc self.grdROMS.lonname = 'lon_rho' self.grdROMS.latname = 'lat_rho' self.grdROMS.opennetcdf(self.romsgridpath) self.grdROMS.createobject(self) self.grdROMS.getdims() # Create the grid object for the input grid self.grdMODEL = grd.Grd("FORCINGDATA", self) self.grdMODEL.grdType = self.grdtype self.grdMODEL.lonName = self.lonname self.grdMODEL.latName = self.latname self.grdMODEL.depthName = self.depthname self.grdMODEL.fillval = self.fillvaluein
def __init__(self): print('model2roms started ' + time.ctime(time.time())) os.environ['WRAP_STDERR'] = 'true' # Set compileAll to True if you want automatic re-compilation of all the # fortran files necessary to run model2roms. Options are "gfortran" or "ifort". Edit # compile.py to add other Fortran compilers. self.compileall = False # Create the bry, init, and clim files for a given grid and input data self.createoceanforcing = True # Create atmospheric forcing for the given grid self.createatmosforcing = False # currently in beta stages and unavailable # Write ice values to file (for Arctic regions) self.writeice = True # ROMS sometimes requires input of ice and ssh, but if you dont have these write zero files to file self.set2DvarsToZero= False # Use ESMF for the interpolation. This requires that you have ESMF and ESMPy installed (import ESMF) self.useesmf = True # Apply filter to smooth the 2D fields after interpolation (time consuming but enhances results) self.usefilter = False # Format to write the ouput to: 'NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', or 'NETCDF3_CLASSIC' # Using NETCDF4 automatically turns on compression of files (ZLIB) self.myformat = 'NETCDF4' self.myzlib = True # Frequency of the input data: usually monthly self.timefrequencyofinputdata = "day" # , "month", "hour" # Define what grid type you wnat to interpolate from (input MODEL data) # Options: # 1. SODA3, GLORYS self.indatatype = 'GLORYS' # Define the names of the geographical variables in the input files if self.indatatype == "SODA3": self.grdtype = 'regular' self.lonname = "xt_ocean" self.latname = "yt_ocean" self.depthname = "st_ocean" self.lonname_u = "xu_ocean" self.latname_u = "yu_ocean" self.lonname_v = "xu_ocean" self.latname_v = "yu_ocean" self.timename = "time" self.realm = "ocean" self.fillvaluein = -1.e20 if self.indatatype == "GLORYS": self.grdtype = 'regular' self.lonname = "longitude" self.latname = "latitude" self.depthname = "depth" self.lonname_u = "longitude" self.latname_u = "latitude" self.lonname_v = "longitude" self.latname_v = "latitude" self.timename = "time" self.realm = "ocean" self.fillvaluein = -1.e20 # Define contact info for final NetCDF files self.authorname = "Ueslei Adriano Sutil" self.authoremail = "ueslei.sutil (at) inpe.br" # Define what grid type you want to interpolate from: Can be Z for SIGMA for ROMS # vertical coordinate system or ZLEVEL. Also define the name of the dimensions in the input files. # Options: # 1. SIGMA (not propoerly implemented yet), 2. ZLEVEL self.ingridtype = "ZLEVEL" # Define what grid type you want to interpolate to # Options: This is just the name of your grid used to identify your selection later self.outgrid = "antarctic" self.outgridtype = "ROMS" # Define nmber of output depth levels self.nlevels = 30 # Define the grid stretching properties (leave default if uncertain what to pick) self.vstretching = 4 self.vtransform = 2 self.theta_s = 7.0 self.theta_b = 0.2 self.tcline = 20 self.hc = 20 # Define the period to create forcing for self.start_year = 2021 self.end_year = 2021 self.start_month = 1 self.end_month = 1 self.start_day = 17 self.end_day = 18 if int(calendar.monthrange(self.start_year, self.start_month)[1]) < self.start_day: self.start_day = int(calendar.monthrange(self.start_year, self.start_month)[1]) if int(calendar.monthrange(self.end_year, self.end_month)[1]) < self.end_day: self.end_day = int(calendar.monthrange(self.end_year, self.end_month)[1]) self.startdate = datetime(self.start_year, self.start_month, self.start_day) self.enddate = datetime(self.end_year, self.end_month, self.end_day) self.years = [self.start_year + year for year in range(self.end_year + 1 - self.start_year)] self.globalvarnames = self.defineglobalvarnames() self.inputdatavarnames = self.defineinputdatavarnames() self.modelpath = self.defineforcingdatapath() self.romsgridpath = self.defineromsgridpath() if self.compileall is True: import compile; compile.compileallgfortran() if self.createatmosforcing or self.createoceanforcing: self.abbreviation = self.defineabbreviation() self.climname, self.initname, self.bryname = self.defineoutputfilenames() self.showinfo() if self.useesmf: try: import ESMF except ImportError: raise ImportError("Unable to import ESMF") ESMF.Manager(debug=True) # Create the grid object for the output grid self.grdROMS = grd.Grd("ROMS", self) self.grdROMS.nlevels = self.nlevels self.grdROMS.vstretching = self.vstretching self.grdROMS.vtransform = self.vtransform self.grdROMS.theta_s = self.theta_s self.grdROMS.theta_b = self.theta_b self.grdROMS.tcline = self.tcline self.grdROMS.hc = self.hc self.grdROMS.lonname = 'lon_rho' self.grdROMS.latname = 'lat_rho' self.grdROMS.opennetcdf(self.romsgridpath) self.grdROMS.createobject(self) self.grdROMS.getdims() # Create the grid object for the input grid self.grdMODEL = grd.Grd("FORCINGDATA", self) self.grdMODEL.grdType = self.grdtype self.grdMODEL.lonName = self.lonname self.grdMODEL.latName = self.latname self.grdMODEL.depthName = self.depthname self.grdMODEL.fillval = self.fillvaluein
def getStationData(confM2R): fileNameIn = confM2R.modelpath + 'SODA_2.0.2_' + str(years[0]) + '_' + str( IDS[0]) + '.cdf' """First time in loop, get the essential old grid information""" """SODA data already at Z-levels. No need to interpolate to fixed depths, but we use the one we have""" grdMODEL = grd.Grd(fileNameIn, "SODA") IOverticalGrid.get_z_levels(grdMODEL) station = 0 numberOfPoints = 4 for lat, lon in zip(confM2R.latlist, confM2R.lonlist): print(( '\n----------------NEW STATION==> %s ------------------------------------------' % (stationNames[station]))) """Now we want to find the indices for our longitude, latitude station pairs in the lat-long list""" gridIndexes, dis = getStationIndices(confM2R.grdMODEL, lon, lat, 'SODA', confM2R.numberofpoints) stTime = [] stDate = [] time = 0 counter = 0 t = 0 years = confM2R.end_year - confM2R.start_year IDS = np.arange(0, 12, 1) for year in years: for ID in IDS: file = "SODA_2.0.2_" + str(year) + "_" + str(ID) + ".cdf" filename = confM2R.modelpath + file jdsoda, yyyymmdd, message = getStationTime( confM2R.grdMODEL, year, ID) stTime.append(jdsoda) stDate.append(yyyymmdd) cdf = Dataset(filename, 'r') """Each SODA file consist only of one time step. Get the subset data selected, and store that time step in a new array:""" if year == years[0] and ID == IDS[0]: validIndex, validDis = testValidStation( cdf, dis, confM2R.numberofpoints, gridIndexes) deepest = testValidDepth(cdf, confM2R.numberofpoints, gridIndexes, confM2R.grdMODEL.depth) stTemp, stSalt, stSSH, stUvel, stVvel, stTauX, stTauY = initArrays( years, IDS, deepest, confM2R.stationnames[station], lon, lat) for i in validIndex: wgt = float(validDis[i]) / sum(validDis) latindex = int(gridIndexes[i][0]) lonindex = int(gridIndexes[i][1]) """The values at a station is calculated by interpolating from the numberOfPoints around the station uysing weights (wgt) """ stTemp[time, :] = stTemp[time, :] + (cdf.variables["TEMP"][ t, 0:deepest, latindex, lonindex]) * wgt stSalt[time, :] = stSalt[time, :] + (cdf.variables["SALT"][ t, 0:deepest, latindex, lonindex]) * wgt stSSH[time] = stSSH[time] + ( cdf.variables["SSH"][t, latindex, lonindex]) * wgt stTauX[time] = stTauX[time] + ( cdf.variables["TAUX"][t, latindex, lonindex]) * wgt stTauY[time] = stTauY[time] + ( cdf.variables["TAUY"][t, latindex, lonindex]) * wgt stUvel[time, :] = stUvel[time, :] + (cdf.variables["U"][ t, 0:deepest, latindex, lonindex]) * wgt stVvel[time, :] = stVvel[time, :] + (cdf.variables["V"][ t, 0:deepest, latindex, lonindex]) * wgt cdf.close() counter += 1 time += 1 print(('Total time steps saved to file %s for station %s' % (time, station))) #plotData.contourStationData(stTemp,stTime,stDate,-grdMODEL.depth[0:deepest],stationNames[station]) outfilename = 'station_' + str(confM2R.stationnames[station]) + '.nc' print(('Results saved to file %s' % (outfilename))) writeStationNETCDF4(stTemp, stSalt, stUvel, stVvel, stSSH, stTauX, stTauY, stTime, confM2R.grdMODEL.depth[0:deepest], lat, lon, outfilename) station += 1