HYPE
Loading...
Searching...
No Matches
readwrite_routines Module Reference

Functions/Subroutines

subroutine, public hyss_log_prepare_file (dir, logdate, logtime, seq, status)
subroutine, public hyss_log_progress (oldyear, newyear)
subroutine, public check_file_station_id_order (funit, infile, ns, nskip, geostn, ptindex, ncols, status)
subroutine, public find_reorder_index (file, n, oldstn, n2, newstn, allflag, aindex, status)
subroutine, public check_station_txt (funit, infile, ns, nskip, geostn, nobsstn, oindex, status)
subroutine check_station_array (infile, ns, geostn, nobsstn, obsstn, oindex, status)
subroutine, public check_xobs (funit, infile, nskip, ncols, varinfo, status)
subroutine, public read_headings_pointsource_timeseries (funit, infile, ncols, varname, varinfo, status)
subroutine, public prepare_read_matrix (fileunit, infile, nskip, bdate, status)
subroutine, public check_obs_timeperiod (fileunit, infile, nskip, fileperiod, bdate, edate, filestartdate, fileenddate, twostringtimefound, status)
subroutine, public find_common_timeperiod (bdate, edate, fbdate, fedate, bcdate, ecdate, overlap)
subroutine, public read_matrix_line (fileunit, ncols, miss, readdateform, d, y, status)
subroutine, public read_matrix (funit, dimrows, ncols, edate, miss, readdateform, nrows, tx, xall, status)
subroutine, public load_one_netcdf_forcing_variable (ns, ndt, bdate, edate, forcobs, n_result)
subroutine, public get_netcdf_forcing_id_order (fileid, ns, forcobs, n_result)
subroutine, public open_netcdf_file_and_get_ids (filepath, fname, missing, fileid, varid, nstn, n_result)
subroutine, public get_id_of_netcdf_variable (varstr, nc_fileid, nc_varid, n_result)
subroutine, public check_netcdf_station_id_order (filepath, fileid, ns, nstn, obsindex, n_result)
subroutine, public check_netcdf_forcing_timeperiod (nc_fileid, forcobs, bdate, edate, n_result)
subroutine, public check_netcdf_observation_timeperiod (nc_fileid, obsdata, bdate, edate, filestartdate, fileenddate, n_result)
subroutine read_netcdf_forcing_matrix (forcobs, dimrows, ncols, xall, n_result)
subroutine, public close_netcdf_file (nc_fileid, n_result)
subroutine, public load_netcdf_dates_of_forcing_variable (ndt, forcobs, n_result)
subroutine, public load_one_current_date_netcdf (idt, forcobs, current_date)
subroutine read_one_current_date_netcdf (idt, forcobs, date)
subroutine get_calendar_from_netcdf_file (forcobs, attvalue)
subroutine transform_time_since_to_datetype (time, timeunit, date)
subroutine get_date_from_time_since (time, timeunit, sincedate, date)
subroutine get_time_since_from_date (time, timeunit, sincedate, date)
subroutine, public get_one_current_forcing_data_netcdf (idt, ns, forcobs, current_value)
subroutine, public get_one_current_observation_data_netcdf (idt, ns, obsdata, y)
subroutine, public count_data_negative_in_ncfile (nc_file, nc_var, ns, oindex, miss, fmissing, numneg, negfound, n_result)
subroutine, public count_data_missing_in_ncfile (nc_file, nc_var, forcobs, ns, fmissing, nummiss, missfound, n_result)
subroutine, public load_and_check_qobs_netcdf (dirf, varname, ns, ndt, bdate, edate, n_result)
subroutine, public check_xobs_netcdf (filepath, nso, subnr, bdate, edate, varname, obsdata, n_result)
subroutine, public load_xobs_netcdf (ndt, bdate, edate, obsdata, x2, n_result)
subroutine, public open_timefiles_netcdf (dir, n, iens, runens, allens, ensstat)
subroutine, public calculate_seconds_beginning_period (idt, nperiod, ct, beginvalue)
subroutine, public calculate_next_time_index_of_ncfile (ncid, nextindex)
subroutine, public write_data_to_netcdf (ncid, itime, dim, variable, beginseconds, values)
subroutine, public close_timefiles_netcdf (iens, ensstat)
subroutine, public get_one_current_observation_data_netcdf (idt, ns, obsdata, y)
subroutine, public check_xobs_netcdf (filepath, nso, subnr, bdate, edate, varname, obsdata, n_result)
subroutine, public create_filename_for_variable (filename, outputtype, variablename, areaagg, suffix1, suffix2, suffix2format, suffix3, suffix4, fileend)
subroutine, public write_integer_header (funit, n, columnid, firstcolumn)
subroutine get_first_column_string_for_dataline (per, mlab, t, id, d, odate)
subroutine, public write_dataline (iout, n, x, ndec, nsig, per, sep, abb, mlab, id, d, odate)
subroutine, public write_comment_with_metadata (line, model, variable, classes, timestep, unit, comment)
subroutine, public write_commentline_to_file (funit, comment)
subroutine, public write_mathsep (iout, n, x, nsig, textin, separator)
subroutine, public write_sepsep (iout, n, x, ndec, textin, separator, abb)
logical function check_character (charin)
integer function count_words (line)
subroutine, public count_data_comment_cols_and_rows (funit, infile, nskip, ncols, nrows, status)
subroutine, public count_data_comment_and_cols (funit, infile, nskip, ncols, status)
subroutine, public count_data_cols (funit, infile, nskip, ncols, status)
subroutine, public count_data_rows (funit, infile, nskip, n, status)
subroutine, public count_comment_rows (funit, infile, ncomment, status)
subroutine, public skip_comment_rows (funit, ncomment, status)
subroutine, public get_number_of_classgroups (readnclass, dim, outgroups, ndefgroup)
subroutine, public read_geoclass (funit, infile, n, x, dmax)
subroutine, public read_basindata5 (funit, fname, maxcol, n, mcols, code, nrows, rindex, iindex, xi, xr)
subroutine, public read_basindata6 (funit, fname, maxcol, n, mcols, dimstr, code, nrows, rindex, iindex, sindex, xi, xr, xs)
subroutine, public read_column_headings (funit, maxcol, nstr, str, mcols, status)
subroutine, public read_column_headings2 (line, maxcol, nstr, str, mcols, status)
subroutine, public read_next_codestr_on_line (linelen, strlen, pos, line, str, nostrfound, errstr, keepc)
subroutine, public read_next_date_on_line (linelen, strlen, pos, line, str, nostrfound, twostringtimefound, errstr)
subroutine, public read_next_column (linelen, strlen, line, str, pos, ierr)
subroutine, public read_next_integer_on_info_line (linelen, pos, line, exitflag, errorflag, intvalue, maxvalue, minvalue)
subroutine, public add_number_to_filename (i, n, fname)
subroutine, public read_array_from_file (ffunit, rowmax, dim, array)
subroutine, public read_array_from_file2 (ffunit, rowmax, dim, array)
subroutine, public read_array_from_binfile (ffunit, next_record, rowmax, dim, array)
subroutine, public write_array_to_file (ffunit, rowmax, dim, array)
subroutine, public write_array_to_file2 (ffunit, rowmax, dim, array)
subroutine, public write_array_to_binfile (ffunit, next_record, rowmax, dim, array)
subroutine, public read_parameterline (line, dim, varstr, values, nvalues)
subroutine, public print_output_information_to_logfile (funit)
subroutine, public compress_and_delete_file (dir, filename)
subroutine, public decompress_file_in_place (dir, filename)

Detailed Description

Module for reading and writing to files.

Function/Subroutine Documentation

◆ add_number_to_filename()

subroutine, public readwrite_routines::add_number_to_filename ( integer, intent(in) i,
integer, intent(in) n,
character(len=*), intent(inout) fname )

Add sequence/ensemble number to filename.

Parameters
[in]inumber of file
[in]nnumber of digits
[in,out]fnamefile name

◆ calculate_next_time_index_of_ncfile()

subroutine public readwrite_routines::calculate_next_time_index_of_ncfile ( integer, intent(in) ncid,
integer, intent(out) nextindex )

Calculate time index to write.

Parameters
[in]ncidFile unit of netcdf file
[out]nextindexnext time for output
Here is the caller graph for this function:

◆ calculate_seconds_beginning_period()

subroutine public readwrite_routines::calculate_seconds_beginning_period ( integer, intent(in) idt,
integer, intent(in) nperiod,
type(timeinformationtype), intent(in) ct,
double precision, intent(out) beginvalue )

Calculate output file time stamp; beginning of mean period in seconds since.

Parameters
[in]idtCurrent time
[in]nperiodAccumulation/Average period, number of timesteps
[in]ctcurrent time
[out]beginvaluetime stamp for output
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_character()

logical function readwrite_routines::check_character ( character (len=1), intent(in) charin)
private

The character may consist of letters, numbers or underscore.

Parameters
[in]charinCharacter to be checked
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_file_station_id_order()

subroutine, public readwrite_routines::check_file_station_id_order ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(in) ns,
integer, intent(in) nskip,
integer, dimension(ns), intent(in) geostn,
integer, dimension(ns), intent(out) ptindex,
integer, intent(out) ncols,
integer, intent(out) status )

Opens a file with observations and checks if the column ids is the same as wanted by the model set up. Returns a index array with reorder information. Used for forcing data files (e.g. Pobs.txt) and LeakageData.txt.

Parameters
[in]funitUnit for file
[in]infileName of file to be read
[in]nsTotal number of stations/subbasins
[in]nskipNumber of row to skip to start read station number row
[in]geostnSubbasin identification number in model (GeoData.txt or ForcKey.txt)
[out]ptindexIndex table for order of stations in file compared to GeoData
[out]ncolsNumber of columns/timeseries in file
[out]statuserror number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_netcdf_forcing_timeperiod()

subroutine public readwrite_routines::check_netcdf_forcing_timeperiod ( integer, intent(in) ncfile,
type(forcingdatatype), intent(inout) forcobs,
type(datetype), intent(in) bdate,
type(datetype), intent(in) edate,
integer, intent(out) n_result )

Reads the time format of the file, and save the information for later use. Checks the first, second and last date against simulation time step and time period.

Parameters
[in]nc_fileidfile id, not set in forcobs yet
[in,out]forcobsdata/information for one forcing variable
[in]bdateBegin date of simulation
[in]edateEnd date of simulation
[out]n_resultStatus
[in]ncfilefile id, not set in forcobs yet
[in,out]forcobsdata/information for one forcing variable
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_netcdf_observation_timeperiod()

subroutine public readwrite_routines::check_netcdf_observation_timeperiod ( integer, intent(in) nc_fileid,
type(observationdatatype), intent(inout) obsdata,
type(datetype), intent(in) bdate,
type(datetype), intent(in) edate,
type(datetype), intent(out) filestartdate,
type(datetype), intent(out) fileenddate,
integer, intent(out) n_result )

Reads the time format of the file, and save the information for later use. Checks the first and last date against time period.

Parameters
[in]nc_fileidfile id, not set in forcobs yet
[in,out]obsdatadata/information for one observation variable
[in]bdateBegin date of simulation
[in]edateEnd date of simulation
[out]filestartdateBegin date of data in file
[out]fileenddateEnd date of data in file
[out]n_resultStatus
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_netcdf_station_id_order()

subroutine public readwrite_routines::check_netcdf_station_id_order ( character(len=maxcharpath), intent(in) filepath,
integer, intent(in) fileid,
integer, intent(in) ns,
integer, intent(in) nstn,
integer, dimension(ns), intent(out) obsindex,
integer, intent(out) n_result )

Get subbasin index order from a netcdf file id variable order.

Parameters
[in]filepathfile directory
[in]fileidid of file
[in]nsnumber of subbasins (basemodel)
[in]nstnnumber of stations
[out]obsindexindex of subbasins
[out]n_resulterror status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_obs_timeperiod()

subroutine, public readwrite_routines::check_obs_timeperiod ( integer, intent(in) fileunit,
character (len=*), intent(in) infile,
integer, intent(in) nskip,
integer, intent(in) fileperiod,
type(datetype), intent(in) bdate,
type(datetype), intent(in) edate,
type(datetype), intent(out) filestartdate,
type(datetype), intent(out) fileenddate,
logical, intent(out) twostringtimefound,
integer, intent(out) status )

Opens a file with observations and reads the first and last datetime Can handle timesteply, monthly and yearly files.

Parameters
[in]infileName of file
[in]nskipNumber of rows to skip in file to start reading dates
[in]fileperiodTimestep of file (e.g timesteply or monthly)
[in]bdateBegin date of simulation
[in]edateEnd date of simulation
[out]filestartdateStart date in file
[out]fileenddateEnd date in file
[out]twostringtimefounddatetime format for reading; one or two strings
[out]statuserror number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_station_array()

subroutine readwrite_routines::check_station_array ( character (len=*), intent(in) infile,
integer, intent(in) ns,
integer, dimension(ns), intent(in) geostn,
integer, intent(in) nobsstn,
integer, dimension(nobsstn), intent(in) obsstn,
integer, dimension(ns), intent(out) oindex,
integer, intent(out) status )
private

Opens a file with time series of observations and count and check stations and save their order. Used for Qobs- and XobsXOMS-files.

Parameters
[in]infileName of file to be read
[in]nsNumber of subbasins
[in]geostnsubbasin id in GeoData.txt
[in]nobsstnNumber of stations
[in]obsstnsubbasin id of stations
[out]oindexIndex to find correct station in matrix
[out]statuserror number
Here is the caller graph for this function:

◆ check_station_txt()

subroutine, public readwrite_routines::check_station_txt ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(in) ns,
integer, intent(in) nskip,
integer, dimension(ns), intent(in) geostn,
integer, intent(out) nobsstn,
integer, dimension(ns), intent(out) oindex,
integer, intent(out) status )

Opens a file with time series of observations and count and check stations and save their order. Used for Qobs-, Wobs- and XobsXOMS-files.

Parameters
[in]funitUnit for file
[in]infileName of file to be read
[in]nsNumber of subbasins
[in]nskipNumber of comment row to skip before station row
[in]geostnsubbasin id in GeoData.txt
[out]nobsstnNumber of columns in file
[out]oindexIndex to find correct station in matrix
[out]statuserror number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_xobs()

subroutine, public readwrite_routines::check_xobs ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(in) nskip,
integer, intent(in) ncols,
integer, dimension(ncols,2), intent(out) varinfo,
integer, intent(out) status )

Opens a file with observations, reads which variables it contains and save that information. Used for Xobs.txt and Xoregobs.txt.

Parameters
[in]funitFile unit for file
[in]infileName of file to be read
[in]nskipNumber of comment row to skip before variable and subbasin rows
[in]ncolsTotal number of columns
[out]varinfoxobs variable numbers and subbasin id
[out]statuserror number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_xobs_netcdf() [1/2]

subroutine, public readwrite_routines::check_xobs_netcdf ( character(len=*), intent(in) filepath,
integer, intent(in) nso,
integer, dimension(nso), intent(in) subnr,
type(datetype), intent(in) bdate,
type(datetype), intent(in) edate,
character(len=4) varname,
type(observationdatatype), intent(inout) obsdata,
integer, intent(out) n_result )

◆ check_xobs_netcdf() [2/2]

subroutine, public readwrite_routines::check_xobs_netcdf ( character(len=*), intent(in) filepath,
integer, intent(in) nso,
integer, dimension(nso), intent(in) subnr,
type(datetype), intent(in) bdate,
type(datetype), intent(in) edate,
character(len=*), intent(in) varname,
type(observationdatatype), intent(inout) obsdata,
integer, intent(out) n_result )

Check and count other obs nc file.

Parameters
[in]filepathFile directory and path (forcingdir)
[in]nsoNumber of subbasins (basemodel) or outregions
[in]subnrid of all subbasins/outregions
[in]bdateBegin simulation date
[in]edateEnd simulation date
[in]varnameoutvar shortname (capitals)
[in,out]obsdatadata/information on a forcing variable
[out]n_resultError number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ close_netcdf_file()

subroutine public readwrite_routines::close_netcdf_file ( integer, intent(in) nc_fileid,
integer, intent(out) n_result )

Close netcdf file.

Parameters
[in]nc_fileidfile unit variable
[out]n_resultstatus of subroutine
Here is the caller graph for this function:

◆ close_timefiles_netcdf()

subroutine public readwrite_routines::close_timefiles_netcdf ( integer, intent(in) iens,
integer, intent(in), optional ensstat )

Close netcdf time file.

Parameters
[in]iensCurrent simulation
[in]ensstatFlag for writing parallell ensemble files
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compress_and_delete_file()

subroutine, public readwrite_routines::compress_and_delete_file ( character(len=*), intent(in) dir,
character(len=*), intent(in) filename )

Takes a ASCII files and compresses it with tar and gzip. Then deletes the text-file.

Parameters
[in]dirfile directory
[in]filenamefile name including 4 letter fileending (.txt)

Algoritm
Go to text-file and compress it in place

Delete the text-file.

Here is the caller graph for this function:

◆ count_comment_rows()

subroutine, public readwrite_routines::count_comment_rows ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(out) ncomment,
integer, intent(out) status )

Counts possible comment lines (starting with !!) in the beginning of a file.

Parameters
[in]funitUnit for file
[in]infileName of file to be read
[out]ncommentActual number of comment rows in file
[out]statusError status
Here is the caller graph for this function:

◆ count_data_cols()

subroutine, public readwrite_routines::count_data_cols ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(in) nskip,
integer, intent(out) ncols,
integer, intent(out) status )

Reads a matrix of data, count the number of columns.

Parameters
[in]funitUnit for file
[in]infileName of file to be read
[in]nskipNumber of comment rows to skip in the beginning
[out]ncolsTotal number of columns
[out]statusError number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ count_data_comment_and_cols()

subroutine, public readwrite_routines::count_data_comment_and_cols ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(out) nskip,
integer, intent(out) ncols,
integer, intent(out) status )

Reads a matrix of data, count the number of comment rows, columns, and rows with data.

Parameters
[in]funitUnit for file
[in]infileName of file to be read
[out]nskipNumber of rows to skip
[out]ncolsNumber of data rows
[out]statusError status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ count_data_comment_cols_and_rows()

subroutine, public readwrite_routines::count_data_comment_cols_and_rows ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(out) nskip,
integer, intent(out) ncols,
integer, intent(out) nrows,
integer, intent(out) status )

Reads a matrix of data, count the number of comment rows, columns, and rows with data.

Parameters
[in]funitUnit for file
[in]infileName of file to be read
[out]nskipNumber of rows to skip
[out]ncolsNumber of data rows
[out]nrowsNumber of data rows
[out]statusError status
Here is the call graph for this function:

◆ count_data_missing_in_ncfile()

subroutine public readwrite_routines::count_data_missing_in_ncfile ( integer, intent(in) nc_file,
integer, intent(in) nc_var,
type(forcingdatatype), intent(in) forcobs,
integer, intent(in) ns,
real, intent(in) fmissing,
integer, dimension(ns), intent(out) nummiss,
integer, intent(out) missfound,
integer, intent(out) n_result )

Check and count for missing data in file. Used for forcing data files; Tobs.nc, TMINobs.nc and TMAXobs.nc.

Parameters
[in]nc_filefile id variable
[in]nc_varvariable id
[in]forcobsdata/information on a forcing variable
[in]nsNumber of subbasins, basemodel
[in]fmissingthe missing value used in the file
[out]nummissNumber of missing values per subbasin
[out]missfoundCode for found missing data
[out]n_resulterror code

Algoritm
Set default output

Find dimensions of observation data

Load forcing data

Check if missing values found among the used data

Here is the caller graph for this function:

◆ count_data_negative_in_ncfile()

subroutine public readwrite_routines::count_data_negative_in_ncfile ( integer, intent(in) nc_file,
integer, intent(in) nc_var,
integer, intent(in) ns,
integer, dimension(ns), intent(in) oindex,
integer, intent(in) miss,
real, intent(in) fmissing,
integer, dimension(ns), intent(out) numneg,
integer, intent(out) negfound,
integer, intent(out) n_result )

Check for negative data in file maybe also for missing values (Pobs.txt,..).

Parameters
[in]nc_filefile id variable
[in]nc_varvariable id
[in]nsNumber of subbasins, basemodel
[in]oindexindex for subbasins
[in]missFlag for including missing values, 0=count, 1=ignore
[in]fmissingthe missing value of the file
[out]numnegNumber of negative values per subbasin
[out]negfoundCode for found negative data
[out]n_resulterror code

Algoritm
Set default output

Find dimensions of observation data

Load observation data, bdate and forward

Check if negative values found among the loaded data

Here is the caller graph for this function:

◆ count_data_rows()

subroutine, public readwrite_routines::count_data_rows ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(in) nskip,
integer, intent(out) n,
integer, intent(out) status )

Reads a matrix of data, count the number of rows.

Parameters
[in]funitUnit for file
[in]infileName of file to be read
[in]nskipNumber of rows to skip
[out]nNumber of data rows
[out]statusError status
Here is the caller graph for this function:

◆ count_words()

integer function readwrite_routines::count_words ( character (len=*), intent(in) line)
private

Count number of word on line separated by blank or tab. The words may consist of letters, numbers or underscore. Only last character of a word is checked though.

Parameters
[in]lineLine to be read
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_filename_for_variable()

subroutine, public readwrite_routines::create_filename_for_variable ( character(len=*), intent(out) filename,
character(len=*), intent(in) outputtype,
character(len=4), intent(in) variablename,
integer, intent(in) areaagg,
character(len=*), intent(in), optional suffix1,
integer, intent(in), optional suffix2,
logical, intent(in), optional suffix2format,
integer, intent(in), optional suffix3,
character(len=*), intent(in), optional suffix4,
character(len=*), intent(in), optional fileend )

Create file name string for time- or map file.

Parameters
[out]filenamefile name
[in]outputtypetime- or map-file
[in]variablenamecode for variable; to be name of file
[in]areaaggsubbasin, upstream or output region variable
[in]suffix1string file suffix
[in]suffix2integer file suffix
[in]suffix2formatuse 6 character suffix instead of three
[in]suffix3integer suffix for classoutput
[in]suffix4classgroup name suffix
[in]fileendfile ending (default is txt, used for .nc)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ decompress_file_in_place()

subroutine, public readwrite_routines::decompress_file_in_place ( character(len=*), intent(in) dir,
character(len=*), intent(in) filename )

Take an archive file (.tgz) and extracts the ASCII-file in it in the same folder.

Parameters
[in]dirfile directory
[in]filenamefile name including 4 letter fileending (.txt)

Algoritm
Go to tgz-file and decompress it in place

Here is the caller graph for this function:

◆ find_common_timeperiod()

subroutine, public readwrite_routines::find_common_timeperiod ( type(datetype), intent(in) bdate,
type(datetype), intent(in) edate,
type(datetype), intent(in) fbdate,
type(datetype), intent(in) fedate,
type(datetype), intent(out) bcdate,
type(datetype), intent(out) ecdate,
logical, intent(out) overlap )

Compare simulation time period with file time period and find overlap.

Parameters
[in]bdateBegin date of simulation
[in]edateEnd date of simulation
[in]fbdateBegin date of file
[in]fedateEnd date of file
[out]bcdateStart date of common period
[out]ecdateEnd date of common period
[out]overlapStatus of overlap
Here is the caller graph for this function:

◆ find_reorder_index()

subroutine, public readwrite_routines::find_reorder_index ( character (len=*), intent(in) file,
integer, intent(in) n,
integer, dimension(n), intent(in) oldstn,
integer, intent(in) n2,
integer, dimension(n2), intent(in) newstn,
logical, intent(in) allflag,
integer, dimension(n), intent(out) aindex,
integer, intent(out) status )

Calculate the index correspondence of two id-arrays. Check if content of arrays is the same if flagged.

Parameters
[in]fileName of entity whose array (newstn) is checked (for error message)
[in]nSize of original array
[in]oldstnOriginal array
[in]n2Size of new array
[in]newstnNew array with possible different number of and order of elements
[in]allflagStatus: all stations is to be matched, error if not
[out]aindexIndex table for order of newstn compared to oldstn
[out]statusError status

Algoritm

If the size of arrays is the same: for every element

  • Check if identical element in other array
  • Else check if element found in other array
  • If not found and that is error write error message and return

Elseif the size of arrays is not the same: for every element

  • Check if element found in other array
  • If not found and that is error write error message and return
Here is the caller graph for this function:

◆ get_calendar_from_netcdf_file()

subroutine readwrite_routines::get_calendar_from_netcdf_file ( type(forcingdatatype), intent(in) forcobs,
character(len=*), intent(out) attvalue )
private

Get calendar from netcdf forcing data file.

Parameters
[in]forcobsdata/information for one forcing variable
[out]attvaluetime

Default output

Check if attribute calendar exist

Get calendar attribute

Here is the caller graph for this function:

◆ get_date_from_time_since()

subroutine readwrite_routines::get_date_from_time_since ( double precision, intent(in) time,
character(len=16), intent(in) timeunit,
type(datetype), intent(in) sincedate,
type(datetype), intent(out) date )
private

Transform time (in units since date) to date in dateType format.

Parameters
[in]timetime in units since specified date
[in]timeunittime resolution/time unit
[in]sincedatespecified date time is calculculated from
[out]datetime in DateType format
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_first_column_string_for_dataline()

subroutine readwrite_routines::get_first_column_string_for_dataline ( integer, intent(in) per,
logical, intent(in) mlab,
character(len=16), intent(out) t,
integer, intent(in), optional id,
type(datetype), intent(in), optional d,
type(datetype), intent(in), optional odate )
private

Print one line, separated by TAB (=CHAR(9)) or selected separator and with ndec decimals or nsig signficiant figures.

Parameters
[in]perTime period for date print out or integer print out
[in]mlabSwitch for MATLAB format (FALSE ,e.g dates with -; TRUE e.g % before title row)
[out]tThe first column data as string
[in]idID to be used as column 1 (e.g. subid or ensemble number)
[in]dDate to be used as column 1
[in]odateStart date for output period
Here is the caller graph for this function:

◆ get_id_of_netcdf_variable()

subroutine public readwrite_routines::get_id_of_netcdf_variable ( character (len=*), intent(in) varstr,
integer, intent(in) nc_fileid,
integer, intent(out) nc_varid,
integer, intent(out) n_result )

Get a variable id for later reading from a netcdf data file.

Parameters
[in]varstrName of variable to be read
[in]nc_fileidfile id
[out]nc_varidvariable id
[out]n_resulterror number
Here is the caller graph for this function:

◆ get_netcdf_forcing_id_order()

subroutine public readwrite_routines::get_netcdf_forcing_id_order ( integer, intent(in) fileid,
integer, intent(in) ns,
type(forcingdatatype), intent(inout) forcobs,
integer, intent(out) n_result )

Get subbasin index order from a netcdf forcing variable's station order.

Parameters
[in]fileidid of file
[in]nsnumber of subbasins (basemodel)
[in,out]forcobsdata/information for one forcing variable
[out]n_resulterror status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_number_of_classgroups()

subroutine, public readwrite_routines::get_number_of_classgroups ( logical, intent(in) readnclass,
integer, intent(in) dim,
integer, dimension(dim), intent(inout) outgroups,
integer, intent(inout) ndefgroup )

Read GeoClass.txt and return number of classes.

Parameters
[in]readnclassFlag for setting class groups from GeoClass
[in]dimMax number of outputs
[in,out]outgroupsNumber of classgroups for each output
[in,out]ndefgroupNumber of defined class groups

Count number of classes

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_one_current_forcing_data_netcdf()

subroutine public readwrite_routines::get_one_current_forcing_data_netcdf ( integer, intent(in) idt,
integer, intent(in) ns,
type(forcingdatatype), intent(in) forcobs,
real, dimension(ns), intent(out) current_value )

Get current forcing data for one variable for selected subbasins from netcdf file.

Parameters
[in]idtcurrent time step
[in]nsnumber of subbasins
[in]forcobsdata/information on a forcing variable
[out]current_valuecurrent value of the forcing variable
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_one_current_observation_data_netcdf() [1/2]

subroutine, public readwrite_routines::get_one_current_observation_data_netcdf ( integer, intent(in) idt,
integer, intent(in) ns,
type(observationdatatype), intent(in) obsdata,
real, dimension(ns), intent(inout) y )

◆ get_one_current_observation_data_netcdf() [2/2]

subroutine, public readwrite_routines::get_one_current_observation_data_netcdf ( integer, intent(in) idt,
integer, intent(in) ns,
type(observationdatatype), intent(in) obsdata,
real, dimension(ns), intent(out) y )

Get current forcing data for one variable for selected subbasins from netcdf file.

Parameters
[in]idtcurrent time step
[in]nsnumber of stations
[in]obsdatadata/information on a observation variable
[out]ycurrent value of the forcing variable
Here is the caller graph for this function:

◆ get_time_since_from_date()

subroutine readwrite_routines::get_time_since_from_date ( double precision, intent(out) time,
character(len=16), intent(in) timeunit,
type(datetype), intent(in) sincedate,
type(datetype), intent(in) date )
private

Transform time (as date) to time (in units since since_date).

Parameters
[out]timetime in units since specified date
[in]timeunittime resolution/time unit
[in]sincedatespecified date time is calculculated from
[in]datetime in DateType format
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hyss_log_prepare_file()

subroutine, public readwrite_routines::hyss_log_prepare_file ( character (len=*), intent(in) dir,
character(len=8), intent(in) logdate,
character(len=10), intent(in) logtime,
integer, intent(in) seq,
integer, intent(out) status )

Opens a file for logging of simulation (hyss.log) and write starting time.

Parameters
[in]dirdir for hyss file
[in]logdateDate for log-file name
[in]logtimeTime for log-file name
[in]seqSeqnr for log-file name
[out]statuserror number
Here is the caller graph for this function:

◆ hyss_log_progress()

subroutine, public readwrite_routines::hyss_log_progress ( integer, intent(inout) oldyear,
integer, intent(in) newyear )

Log simulation progress to log-file.

Parameters
[in,out]oldyearYear id of last timestep
[in]newyearYear id of current timestep
Here is the caller graph for this function:

◆ load_and_check_qobs_netcdf()

subroutine public readwrite_routines::load_and_check_qobs_netcdf ( character(len=*), intent(in) dirf,
character(len=*), intent(in) varname,
integer, intent(in) ns,
integer, intent(in) ndt,
type(datetype), intent(in) bdate,
type(datetype), intent(in) edate,
integer, intent(out) n_result )

Check and count for negative data in Qobs.nc file.

Parameters
[in]dirfFile directory (forcingdir) and file name
[in]varnameVariable name
[in]nsNumber of subbasins, basemodel
[in]ndtNumber of timesteps in simulation
[in]bdateBegin simulation date
[in]edateEnd simulation date
[out]n_resultError number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_netcdf_dates_of_forcing_variable()

subroutine public readwrite_routines::load_netcdf_dates_of_forcing_variable ( integer, intent(in) ndt,
type(forcingdatatype), intent(inout) forcobs,
integer, intent(out) n_result )

Opens a netcdf file with forcing and read the time steps.

Parameters
[in]ndtTotal number of time steps
[in,out]forcobsdata/information for one forcing variable
[out]n_resulterror number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_one_current_date_netcdf()

subroutine public readwrite_routines::load_one_current_date_netcdf ( integer, intent(in) idt,
type(forcingdatatype), intent(in) forcobs,
type(datetype), intent(out) current_date )

Get current date from forcing data from netcdf file.

Parameters
[in]idtcurrent time step
[in]forcobsdata/information for one forcing variable
[out]current_datecurrent date
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_one_netcdf_forcing_variable()

subroutine public readwrite_routines::load_one_netcdf_forcing_variable ( integer, intent(in) ns,
integer, intent(in) ndt,
type(datetype), intent(in) bdate,
type(datetype), intent(in) edate,
type(forcingdatatype), intent(inout) forcobs,
integer, intent(out) n_result )

Opens a netcdf file with observations and prepare it for use. Checks the time period and time step length, and if the ids is the same as in Geodata.txt/ForcKey.txt. Used for Pobs.nc, Tobs.nc etc.

Parameters
[in]nsTotal number of subbasins, basemodel_nsub
[in]ndtTotal number of time steps
[in]bdateBegin date of simulation
[in]edateEnd date of simulation
[in,out]forcobsdata/information for one forcing variable
[out]n_resulterror number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_xobs_netcdf()

subroutine public readwrite_routines::load_xobs_netcdf ( integer, intent(in) ndt,
type(datetype), intent(in) bdate,
type(datetype), intent(in) edate,
type(observationdatatype), intent(inout) obsdata,
real, dimension(:,:), intent(out), allocatable x2,
integer, intent(out) n_result )

Load data from other obs nc file.

Parameters
[in]ndtNumber of timesteps in simulation
[in]bdateBegin simulation date
[in]edateEnd simulation date
[in,out]obsdatadata/information on a forcing variable
[out]x2Data, only used when reading all obs to memory
[out]n_resultError number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ open_netcdf_file_and_get_ids()

subroutine public readwrite_routines::open_netcdf_file_and_get_ids ( character(len=*), intent(in) filepath,
character(len=*), intent(in) fname,
real, intent(out) missing,
integer, intent(out) fileid,
integer, intent(out) varid,
integer, intent(out) nstn,
integer, intent(out) n_result )

Opens a netcdf file with observations and gets the ids of its variables. Leaves the file open. Used for Pobs.nc, Tobs.nc etc.

Parameters
[in]filepathpath and filename
[in]fnamevariable name
[out]missingvalue for missing value in this file
[out]fileidid of file
[out]varidid of forcing variable in file
[out]nstnnumber of stations/columns of forcing variable in file
[out]n_resulterror code
Here is the caller graph for this function:

◆ open_timefiles_netcdf()

subroutine public readwrite_routines::open_timefiles_netcdf ( character(len=*), intent(in) dir,
integer, intent(in) n,
integer, intent(in) iens,
logical, intent(in) runens,
logical, intent(in) allens,
integer, intent(in), optional ensstat )

Creates files for timeserie printout in netcdf format.

Parameters
[in]dirFile directory
[in]nNumber of subbasins
[in]iensCurrent simulation
[in]runensFlag for ensemble run
[in]allensFlag for writing all ensemble results
[in]ensstatFlag for writing parallell ensemble files

Algorithm
Set netcdf time definition for output

Loop over all variables that are to be written

Get information on variable

Create NETCDF4 file

Define variable dimensions

Define variables of netcdf file

Set attibutes

Set user specified attibutes from info.txt

Set attributes to variables

End definition of file phase

Write id variable

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepare_read_matrix()

subroutine, public readwrite_routines::prepare_read_matrix ( integer, intent(in) fileunit,
character (len=*), intent(in) infile,
integer, intent(in) nskip,
type(datetype), intent(in) bdate,
integer, intent(out) status )

Opens a file with observations and reads to starting date.

Parameters
[in]fileunitFileunit for infile
[in]infileName of file to be read
[in]nskipNumber of rows to skip in each file, to start read dates
[in]bdateBegin date
[out]statuserror number
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_output_information_to_logfile()

subroutine, public readwrite_routines::print_output_information_to_logfile ( integer, intent(in) funit)

Log output information to hyss-file.

Parameters
[in]funitFile unit of log-file
Here is the caller graph for this function:

◆ read_array_from_binfile()

subroutine, public readwrite_routines::read_array_from_binfile ( integer, intent(in) ffunit,
integer, intent(inout) next_record,
integer, intent(in) rowmax,
integer, intent(in) dim,
real, dimension(dim), intent(out) array )

Read array values from binary ascii file in chunks.

Parameters
[in]ffunitfile unit
[in,out]next_recordcurrent record of file
[in]rowmaxchunk for writing, reclen
[in]dimdimension of array
[out]arrayarray with values to be written
Here is the caller graph for this function:

◆ read_array_from_file()

subroutine, public readwrite_routines::read_array_from_file ( integer, intent(in) ffunit,
integer, intent(in) rowmax,
integer, intent(in) dim,
real, dimension(dim), intent(out) array )

Read array values from file in chunks.

Parameters
[in]ffunitfile unit
[in]rowmaxchunk for reading
[in]dimdimension of array
[out]arrayarray with read values
Here is the caller graph for this function:

◆ read_array_from_file2()

subroutine, public readwrite_routines::read_array_from_file2 ( integer, intent(in) ffunit,
integer, intent(in) rowmax,
integer, intent(in) dim,
real, dimension(dim), intent(out) array )

Read array values from direct-access file in chunks.

Parameters
[in]ffunitfile unit
[in]rowmaxchunk for reading
[in]dimdimension of array
[out]arrayarray with read values
Here is the caller graph for this function:

◆ read_basindata5()

subroutine, public readwrite_routines::read_basindata5 ( integer, intent(in) funit,
character(len=*), intent(in) fname,
integer, intent(in) maxcol,
integer, intent(in) n,
integer, intent(in) mcols,
integer, dimension(maxcol), intent(in) code,
integer, intent(out) nrows,
integer, dimension(maxcol), intent(out) rindex,
integer, dimension(maxcol), intent(out) iindex,
integer, dimension(n,maxcol), intent(out) xi,
real, dimension(n,maxcol), intent(out) xr )

Reads the data section from tab-separated file. Used for GeoData/LakeData/update.txt and many more.

Parameters
[in]funitUnit for file
[in]fnameError filename
[in]maxcolMaximum number of data columns
[in]nMaximum number of rows (subbasins)
[in]mcolsActual number of columns
[in]codeCode for column variable type
[out]nrowsActual number of rows (subbasins)
[out]rindexIndex for column real variables
[out]iindexIndex for column integer variables
[out]xiInteger data read from file
[out]xrReal data read from file
Here is the call graph for this function:

◆ read_basindata6()

subroutine, public readwrite_routines::read_basindata6 ( integer, intent(in) funit,
character(len=*), intent(in) fname,
integer, intent(in) maxcol,
integer, intent(in) n,
integer, intent(in) mcols,
integer, intent(in) dimstr,
integer, dimension(maxcol), intent(in) code,
integer, intent(out) nrows,
integer, dimension(maxcol), intent(out) rindex,
integer, dimension(maxcol), intent(out) iindex,
integer, dimension(maxcol), intent(out) sindex,
integer, dimension(n,maxcol), intent(out) xi,
real, dimension(n,maxcol), intent(out) xr,
character(len=dimstr), dimension(n,maxcol), intent(out) xs )

Reads the data section from tab-separated file. Also string columns. Used for PointSourceData.txt.

Parameters
[in]funitUnit for file
[in]fnameError filename
[in]maxcolMaximum number of data columns
[in]nMaximum number of rows (subbasins)
[in]mcolsActual number of columns
[in]dimstrMax length of string values
[in]codeCode for column variable type
[out]nrowsActual number of rows (subbasins)
[out]rindexIndex for column real variables
[out]iindexIndex for column integer variables
[out]sindexIndex for column string variables
[out]xiInteger data read from file
[out]xrReal data read from file
[out]xsString data read from file
Here is the call graph for this function:

◆ read_column_headings()

subroutine, public readwrite_routines::read_column_headings ( integer, intent(in) funit,
integer, intent(in) maxcol,
integer, intent(in) nstr,
character(len=nstr), dimension(maxcol), intent(out) str,
integer, intent(out) mcols,
integer, intent(out) status )

Reads the column headings from file and makes the string lower case.

Parameters
[in]funitUnit for file
[in]maxcolMaximum number of data columns
[in]nstrNumber of characters in heading
[out]strColumn headings
[out]mcolsActual number of columns
[out]statusError status
Here is the call graph for this function:

◆ read_column_headings2()

subroutine, public readwrite_routines::read_column_headings2 ( character(len=*), intent(in) line,
integer, intent(in) maxcol,
integer, intent(in) nstr,
character(len=*), dimension(maxcol), intent(out) str,
integer, intent(out) mcols,
integer, intent(out) status )

Reads the column headings from line and makes the string lower case.

Parameters
[in]lineLine with headings
[in]maxcolMaximum number of data columns
[in]nstrMaximum characters of str
[out]strColumn headings
[out]mcolsActual number of columns
[out]statusError status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_geoclass()

subroutine, public readwrite_routines::read_geoclass ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(in) n,
real, dimension(:,:), intent(out), allocatable x,
integer, intent(out) dmax )

Reads a matrix of characteristics for classes.

Parameters
[in]funitUnit for file
[in]infileName of file to be read
[in]nMaximum number of identifications
[out]xIdentification numbers
[out]dmaxNumber of combinations read

Algoritm
Count number of classes (actually nslc include all rows)

Allocate variable for holding class information

Read information of GeoClass.txt

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_headings_pointsource_timeseries()

subroutine, public readwrite_routines::read_headings_pointsource_timeseries ( integer, intent(in) funit,
character (len=*), intent(in) infile,
integer, intent(in) ncols,
character(len=10), dimension(ncols), intent(out) varname,
integer, dimension(ncols), intent(out) varinfo,
integer, intent(out) status )

Opens a file with pointsource time series, reads which variables it contains and save that information.

Parameters
[in]funitFile unit for file
[in]infileName of file to be read
[in]ncolsTotal number of columns
[out]varnamecolumn variable name
[out]varinfocolumn variable pointsource id
[out]statuserror number
Here is the caller graph for this function:

◆ read_matrix()

subroutine, public readwrite_routines::read_matrix ( integer, intent(in) funit,
integer, intent(in) dimrows,
integer, intent(in) ncols,
type(datetype), intent(in) edate,
real, intent(in) miss,
integer, intent(in) readdateform,
integer, intent(out) nrows,
type(datetype), dimension(dimrows), intent(out) tx,
real, dimension(dimrows,ncols), intent(out) xall,
integer, intent(out) status )

Reads a matrix of values in file.

Parameters
[in]funitUnit of file to be read
[in]dimrowsMaximum number of rows
[in]ncolsTotal number of columns
[in]edateEnd date of simulation
[in]missMissing value
[in]readdateformDate-time format of line, one or two strings
[out]nrowsNumber of rows (number of data read in chosen time period)
[out]txDates
[out]xallMatrix with all data in chosen time period
[out]statusStatus of subroutine
Here is the caller graph for this function:

◆ read_matrix_line()

subroutine, public readwrite_routines::read_matrix_line ( integer, intent(in) fileunit,
integer, intent(in) ncols,
real, intent(in) miss,
integer, intent(in) readdateform,
type(datetype), intent(out) d,
real, dimension(ncols), intent(out) y,
integer, intent(out), optional status )

Reads a line of a matrix of values. The format of the time is determined by readdateform (1 for separate date and time in two strings).

Parameters
[in]fileunitFileunit for file being read
[in]ncolsTotal number of columns
[in]missmissing value
[in]readdateformDate-time format of line, one or two strings
[out]dDate (usually days)
[out]yMatrix with data for current day
[out]statusStatus of subroutine
Here is the caller graph for this function:

◆ read_netcdf_forcing_matrix()

subroutine readwrite_routines::read_netcdf_forcing_matrix ( type(forcingdatatype), intent(inout) forcobs,
integer, intent(in) dimrows,
integer, intent(in) ncols,
real, dimension(dimrows,ncols), intent(out) xall,
integer, intent(out) n_result )
private

Read one forcingdata for whole simulation period from netcdf file.

Parameters
[in,out]forcobsdata/information for one forcing variable
[in]dimrowsMaximum number of rows (ndt)
[in]ncolsTotal number of columns
[out]xallMatrix with all data in chosen time period
[out]n_resultError status
Here is the caller graph for this function:

◆ read_next_codestr_on_line()

subroutine, public readwrite_routines::read_next_codestr_on_line ( integer, intent(in) linelen,
integer, intent(in) strlen,
integer, intent(inout) pos,
character(len=linelen), intent(in) line,
character(len=strlen), intent(out) str,
logical, intent(out) nostrfound,
character(len=*), intent(in) errstr,
logical, intent(in), optional keepc )

Read next string from line Ignoring beginning blanks and tabs, remove from line convert to lower case unless keepc is on String can be with or without ' around.

Parameters
[in]linelenLength of line
[in]strlenLength of string
[in,out]posCurrent position on line
[in]lineLine to be read
[out]strRead string
[out]nostrfoundEmpty line, may not be error
[in]errstrValue of str if error
[in]keepcFlag for keeping the capitals
Here is the caller graph for this function:

◆ read_next_column()

subroutine, public readwrite_routines::read_next_column ( integer, intent(in) linelen,
integer, intent(in) strlen,
character(len=linelen), intent(in) line,
character(len=strlen), intent(out) str,
integer, intent(inout) pos,
integer, intent(out) ierr )

Read string from line to next tab and remember the new position on line.

Parameters
[in]linelenlength of line
[in]strlenlength of str
[in]lineline to be read from position pos
[out]strread column
[in,out]posposition on line
[out]ierrerror status
Here is the caller graph for this function:

◆ read_next_date_on_line()

subroutine, public readwrite_routines::read_next_date_on_line ( integer, intent(in) linelen,
integer, intent(in) strlen,
integer, intent(inout) pos,
character(len=linelen), intent(in) line,
character(len=strlen), intent(out) str,
logical, intent(out) nostrfound,
logical, intent(out) twostringtimefound,
character(len=*), intent(in) errstr )

Read next date as string from line, ignoring beginning blanks and tabs. Supports formats yyyy, yyyy-mm, yyyy-mm-dd, yyyy-mm-dd hh:mm, yyyymm, yyyymmdd and yyyymmddhhmm. Sets a flag for formats with a space that need special treatment when reading.

Parameters
[in]linelenLength of line
[in]strlenLength of string
[in,out]posCurrent position on line
[in]lineLine to be read
[out]strRead string
[out]nostrfoundEmpty line, may not be error
[out]twostringtimefoundDate and time as two strings (not only date or matlab format)
[in]errstrValue of str if error
Here is the caller graph for this function:

◆ read_next_integer_on_info_line()

subroutine, public readwrite_routines::read_next_integer_on_info_line ( integer, intent(in) linelen,
integer, intent(inout) pos,
character(len=linelen), intent(in) line,
logical, intent(out) exitflag,
logical, intent(out) errorflag,
integer, intent(out) intvalue,
integer, intent(in), optional maxvalue,
integer, intent(in), optional minvalue )

Read next string from line and interpret it as an integer. Checks the string and value for errors.

Parameters
[in]linelenLength of line
[in,out]posCurrent position on line
[in]lineLine to be read
[out]exitflagFlag for doing a exit/cycle after subroutine exit (error or missing value)
[out]errorflagFlag for error in subroutine
[out]intvalueValue read from info.txt line
[in]maxvalueMaximum value, above is an error
[in]minvalueMinimum value, below is increased
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_one_current_date_netcdf()

subroutine readwrite_routines::read_one_current_date_netcdf ( integer, intent(in) idt,
type(forcingdatatype), intent(in) forcobs,
double precision, intent(out) date )
private

Read one date from Pobs.nc date variable.

Parameters
[in]idtcurrent time step
[in]forcobsdata/information for one forcing variable
[out]datetime

Read time from variable in file for timestep

Here is the caller graph for this function:

◆ read_parameterline()

subroutine, public readwrite_routines::read_parameterline ( character(len=*), intent(in) line,
integer, intent(in) dim,
character(len=10), intent(out) varstr,
real, dimension(dim), intent(out) values,
integer, intent(out) nvalues )

Read parameter name and values from line.

Parameters
[in]lineline of parameter file
[in]dimdimension of parameter type
[out]varstrparameter name
[out]valuesparameter values
[out]nvaluesparameter values read from line

◆ skip_comment_rows()

subroutine, public readwrite_routines::skip_comment_rows ( integer, intent(in) funit,
integer, intent(in) ncomment,
integer, intent(out) status )

Read past comment lines.

Parameters
[in]funitUnit for file
[in]ncommentNumber of rows to skip
[out]statusError status

◆ transform_time_since_to_datetype()

subroutine readwrite_routines::transform_time_since_to_datetype ( double precision, intent(in) time,
character(len=16), intent(in) timeunit,
type(datetype), intent(out) date )
private

Transform time (in units since date) to dateType format.

Parameters
[in]timetime in units since specified date
[in]timeunittime resolution/time unit
[out]datetime in DateType format
Here is the caller graph for this function:

◆ write_array_to_binfile()

subroutine, public readwrite_routines::write_array_to_binfile ( integer, intent(in) ffunit,
integer, intent(inout) next_record,
integer, intent(in) rowmax,
integer, intent(in) dim,
real, dimension(dim), intent(in) array )

Write array values to binary ascii file in chunks.

Parameters
[in]ffunitfile unit
[in,out]next_recordcurrent record of file
[in]rowmaxchunk for writing, reclen?
[in]dimdimension of array
[in]arrayarray with values to be written
Here is the caller graph for this function:

◆ write_array_to_file()

subroutine, public readwrite_routines::write_array_to_file ( integer, intent(in) ffunit,
integer, intent(in) rowmax,
integer, intent(in) dim,
real, dimension(dim), intent(in) array )

Write array values to file in chunks.

Parameters
[in]ffunitfile unit
[in]rowmaxchunk for writing
[in]dimdimension of array
[in]arrayarray with values to be written
Here is the caller graph for this function:

◆ write_array_to_file2()

subroutine, public readwrite_routines::write_array_to_file2 ( integer, intent(in) ffunit,
integer, intent(in) rowmax,
integer, intent(in) dim,
real, dimension(dim), intent(in) array )

Write array values to direct-access file in chunks.

Parameters
[in]ffunitfile unit
[in]rowmaxchunk for writing
[in]dimdimension of array
[in]arrayarray with values to be written
Here is the caller graph for this function:

◆ write_comment_with_metadata()

subroutine, public readwrite_routines::write_comment_with_metadata ( character(len=*), intent(out) line,
character(len=*), intent(in), optional model,
character(len=*), intent(in), optional variable,
character(len=*), intent(in), optional classes,
character(len=*), intent(in), optional timestep,
character(len=*), intent(in), optional unit,
character(len=*), intent(in), optional comment )

Write chosen metadata to one string.

Parameters
[out]lineline to write on
[in]modelmodel version
[in]variablevariable short name
[in]classesincluded classes
[in]timesteptimestep of output data
[in]unitunit of data

Set user specified metadata from info.txt

Here is the caller graph for this function:

◆ write_commentline_to_file()

subroutine, public readwrite_routines::write_commentline_to_file ( integer, intent(in) funit,
character(len=*), intent(in) comment )

Print one line, left adjusted.

Parameters
[in]funitfile unit for print-out
[in]commentcomment to be written
Here is the caller graph for this function:

◆ write_data_to_netcdf()

subroutine public readwrite_routines::write_data_to_netcdf ( integer, intent(in) ncid,
integer, intent(in) itime,
integer, intent(in) dim,
type(outputvariabletype), intent(in) variable,
double precision, intent(in) beginseconds,
real, dimension(dim), intent(in) values )

Write one timestep of data to netcdf time file.

Parameters
[in]ncidFile id
[in]itimeTime index to write to
[in]dimNumber of data values (and ids of file)
[in]variablevariable to be written
[in]beginsecondstime stamp for output
[in]valuesData to be written
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dataline()

subroutine, public readwrite_routines::write_dataline ( integer, intent(in) iout,
integer, intent(in) n,
real, dimension(n), intent(in) x,
integer, intent(in) ndec,
integer, intent(in) nsig,
integer, intent(in) per,
character(len=1), intent(in) sep,
integer, intent(in) abb,
logical, intent(in) mlab,
integer, intent(in), optional id,
type(datetype), intent(in), optional d,
type(datetype), intent(in), optional odate )

Print one line, separated by TAB (=CHAR(9)) or selected separator and with ndec decimals or nsig signficiant figures.

Parameters
[in]ioutUnit for print-out (e.g. 6)
[in]nNumber of values in vector x
[in]xValues
[in]ndecNumber of decimals to be written (rounding to ndec decimals will occurr)
[in]nsigNumber of significant figures to be written (alternative to ndec)
[in]perTime period for date print out or integer print out
[in]sepSeparator in file, e.g ',' or char(9) [=TAB]
[in]abbSwitch for abbreviated format (0=no,e.g 0.1 stays 0.1; 1=yes, e.g 0.1 becomes .1)
[in]mlabSwitch for MATLAB format (FALSE ,e.g dates with -; TRUE e.g % before title row)
[in]idID to be used as column 1 (e.g. subid or ensemble number)
[in]dDate to be used as column 1
[in]odateStart date for output period
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_integer_header()

subroutine, public readwrite_routines::write_integer_header ( integer, intent(in) funit,
integer, intent(in) n,
integer, dimension(n), intent(in) columnid,
character(len=*), intent(in) firstcolumn )

Print header with integer ids, separated by TAB (=CHAR(9)).

Parameters
[in]funitcurrent file unit
[in]nnumber of columns (after first)
[in]columnidid of columns
[in]firstcolumnfirst column header
Here is the caller graph for this function:

◆ write_mathsep()

subroutine, public readwrite_routines::write_mathsep ( integer, intent(in) iout,
integer, intent(in) n,
real, dimension(n), intent(in) x,
integer, intent(in) nsig,
character(len=16), intent(in) textin,
character(len=1), intent(in) separator )

Mathematical print-out, separated by selected separator.

Parameters
[in]ioutFile unit for print-out
[in]nNumber of values in vector x
[in]xValues
[in]nsigNumber of significant figures to be written (rounding will occurr)
[in]textinDate or other id for first column
[in]separatorSeparator in file, e.g ',' or char(9) [=TAB]
Here is the caller graph for this function:

◆ write_sepsep()

subroutine, public readwrite_routines::write_sepsep ( integer, intent(in) iout,
integer, intent(in) n,
real, dimension(n), intent(in) x,
integer, intent(in) ndec,
character(len=16), intent(in) textin,
character(len=1), intent(in) separator,
integer, intent(in) abb )

Compressed print-out, separated by selected separator.

Parameters
[in]ioutUnit for print-out
[in]nNumber of values in vector x
[in]xValues to be written
[in]ndecNumber of decimals to be written (rounding to ndec decimals will occurr)
[in]textinDate or other id for first column
[in]separatorSeparator in file, e.g ',' or char(9) [=TAB]
[in]abbSwitch for abbreviated format (0=no,e.g 0.1 stays 0.1; 1=yes, e.g 0.1 becomes .1)
Here is the caller graph for this function: