Functions/Subroutines | |
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, rindex, iindex, xi, xr) |
subroutine, public | read_basindata6 (funit, fname, maxcol, n, mcols, dimstr, code, 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 | log_progress (oldyear, newyear) |
subroutine, public | print_output_information_to_logfile (funit) |
subroutine, public | compress_and_delete_file (dir, filename) |
subroutine, public | decompress_file_in_place (dir, filename) |
Module for reading and writing to files.
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.
[in] | i | number of file |
[in] | n | number of digits |
[in,out] | fname | file name |
subroutine public readwrite_routines::calculate_next_time_index_of_ncfile | ( | integer, intent(in) | ncid, |
integer, intent(out) | nextindex | ||
) |
Calculate time index to write.
[in] | ncid | File unit of netcdf file |
[out] | nextindex | next time for output |
subroutine public readwrite_routines::calculate_seconds_beginning_period | ( | integer, intent(in) | idt, |
integer, intent(in) | period, | ||
type(timeinformationtype), intent(in) | ct, | ||
double precision, intent(out) | beginseconds | ||
) |
Calculate output file time stamp; beginning of mean period in seconds since.
[in] | idt | Current time |
[in] | nperiod | Accumulation/Average period, number of timesteps |
[in] | ct | current time |
[out] | beginvalue | time stamp for output |
[in] | idt | Current time |
[in] | period | Accumulation/Average period |
[in] | ct | current time |
[out] | beginseconds | time stamp for output |
|
private |
The character may consist of letters, numbers or underscore.
[in] | charin | Character to be checked |
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.
[in] | funit | Unit for file |
[in] | infile | Name of file to be read |
[in] | ns | Total number of stations/subbasins |
[in] | nskip | Number of row to skip to start read station number row |
[in] | geostn | Subbasin identification number in model (GeoData.txt or ForcKey.txt) |
[out] | ptindex | Index table for order of stations in file compared to GeoData |
[out] | ncols | Number of columns/timeseries in file |
[out] | status | error number |
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.
[in] | nc_fileid | file id, not set in forcobs yet |
[in,out] | forcobs | data/information for one forcing variable |
[in] | bdate | Begin date of simulation |
[in] | edate | End date of simulation |
[out] | n_result | Status |
[in] | ncfile | file id, not set in forcobs yet |
[in,out] | forcobs | data/information for one forcing variable |
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.
[in] | nc_fileid | file id, not set in forcobs yet |
[in,out] | obsdata | data/information for one observation variable |
[in] | bdate | Begin date of simulation |
[in] | edate | End date of simulation |
[out] | filestartdate | Begin date of data in file |
[out] | fileenddate | End date of data in file |
[out] | n_result | Status |
[in] | nc_fileid | file id, not set in forcobs yet |
[in,out] | obsdata | data/information for one observation variable |
[in] | bdate | Begin date of simulation |
[in] | edate | End date of simulation |
[out] | filestartdate | Begin date of data in file |
[out] | fileenddate | End date of data in file |
[out] | n_result | Status |
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.
[in] | fileid | id of file |
[in] | ns | number of subbasins (basemodel) |
[in] | nstn | number of stations |
[out] | obsindex | index of subbasins |
[out] | n_result | error status |
[in] | fileid | id of file |
[in] | ns | number of subbasins (basemodel) |
[in] | nstn | number of stations |
[out] | obsindex | index of subbasins |
[out] | n_result | error status |
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.
[in] | infile | Name of file |
[in] | nskip | Number of rows to skip in file to start reading dates |
[in] | fileperiod | Timestep of file (e.g timesteply or monthly) |
[in] | bdate | Begin date of simulation |
[in] | edate | End date of simulation |
[out] | filestartdate | Start date in file |
[out] | fileenddate | End date in file |
[out] | twostringtimefound | datetime format for reading; one or two strings |
[out] | status | error number |
|
private |
Opens a file with time series of observations and count and check stations and save their order. Used for Qobs- and XobsXOMS-files.
[in] | infile | Name of file to be read |
[in] | ns | Number of subbasins |
[in] | geostn | subbasin id in GeoData.txt |
[in] | nobsstn | Number of stations |
[in] | obsstn | subbasin id of stations |
[out] | oindex | Index to find correct station in matrix |
[out] | status | error number |
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.
[in] | funit | Unit for file |
[in] | infile | Name of file to be read |
[in] | ns | Number of subbasins |
[in] | nskip | Number of comment row to skip before station row |
[in] | geostn | subbasin id in GeoData.txt |
[out] | nobsstn | Number of columns in file |
[out] | oindex | Index to find correct station in matrix |
[out] | status | error number |
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.
[in] | funit | File unit for file |
[in] | infile | Name of file to be read |
[in] | nskip | Number of comment row to skip before variable and subbasin rows |
[in] | ncols | Total number of columns |
[out] | varinfo | xobs variable numbers and subbasin id |
[out] | status | error number |
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.
[in] | filepath | File directory and path (forcingdir) |
[in] | nso | Number of subbasins (basemodel) or outregions |
[in] | subnr | id of all subbasins/outregions |
[in] | bdate | Begin simulation date |
[in] | edate | End simulation date |
[in] | varname | outvar shortname (capitals) |
[in,out] | obsdata | data/information on a forcing variable |
[out] | n_result | Error number |
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 | ||
) |
[in] | filepath | File directory and path (forcingdir) |
[in] | nso | Number of subbasins, basemodel |
[in] | subnr | Id of subbasins/ outregions |
[in] | bdate | Begin simulation date |
[in] | edate | End simulation date |
varname | outvar shortname (capitals) | |
[in,out] | obsdata | data/information on a forcing variable |
[out] | n_result | Error number |
subroutine public readwrite_routines::close_netcdf_file | ( | integer, intent(in) | nc_fileid, |
integer, intent(out) | n_Result | ||
) |
Close netcdf file.
[in] | nc_fileid | file unit variable |
[out] | n_result | status of subroutine |
[in] | nc_fileid | file unit variable |
[out] | n_result | status of subroutine |
subroutine public readwrite_routines::close_timefiles_netcdf | ( | integer, intent(in) | iens, |
integer, intent(in), optional | ensstat | ||
) |
Close netcdf time file.
[in] | iens | Current simulation |
[in] | ensstat | Flag for writing parallell ensemble files |
[in] | iens | Current simulation |
[in] | ensstat | Flag for writing parallell ensemble files |
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.
[in] | dir | file directory |
[in] | filename | file name including 4 letter fileending (.txt) |
Algoritm
Go to text-file and compress it in place
Delete the text-file.
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.
[in] | funit | Unit for file |
[in] | infile | Name of file to be read |
[out] | ncomment | Actual number of comment rows in file |
[out] | status | Error status |
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.
[in] | funit | Unit for file |
[in] | infile | Name of file to be read |
[in] | nskip | Number of comment rows to skip in the beginning |
[out] | ncols | Total number of columns |
[out] | status | Error number |
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.
[in] | funit | Unit for file |
[in] | infile | Name of file to be read |
[out] | nskip | Number of rows to skip |
[out] | ncols | Number of data rows |
[out] | status | Error status |
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.
[in] | funit | Unit for file |
[in] | infile | Name of file to be read |
[out] | nskip | Number of rows to skip |
[out] | ncols | Number of data rows |
[out] | nrows | Number of data rows |
[out] | status | Error status |
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.
[in] | nc_file | file id variable |
[in] | nc_var | variable id |
[in] | forcobs | data/information on a forcing variable |
[in] | ns | Number of subbasins, basemodel |
[in] | fmissing | the missing value used in the file |
[out] | nummiss | Number of missing values per subbasin |
[out] | missfound | Code for found missing data |
[out] | n_result | error code |
[in] | nc_file | file id variable |
[in] | nc_var | variable id |
[in] | forcobs | data/information on a forcing variable |
[in] | ns | Number of subbasins, basemodel |
[in] | fmissing | the missing value of the file |
[out] | nummiss | Number of missing values per subbasin |
[out] | missfound | Code for found missing data |
[out] | n_result | error code |
Algoritm
Set default output
Find dimensions of observation data
Load forcing data
Check if missing values found among the used data
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,..)
[in] | nc_file | file id variable |
[in] | nc_var | variable id |
[in] | ns | Number of subbasins, basemodel |
[in] | oindex | index for subbasins |
[in] | miss | Flag for including missing values, 0=count, 1=ignore |
[in] | fmissing | the missing value of the file |
[out] | numneg | Number of negative values per subbasin |
[out] | negfound | Code for found negative data |
[out] | n_result | error code |
[in] | nc_file | file id variable |
[in] | nc_var | variable id |
[in] | ns | Number of subbasins, basemodel |
[in] | oindex | Subbasin index |
[in] | miss | Flag for including missing values, 0=count, 1=ignore |
[in] | fmissing | the missing value of the file |
[out] | numneg | Number of negative values per subbasin |
[out] | negfound | Code for found negative data |
[out] | n_result | error 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
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.
[in] | funit | Unit for file |
[in] | infile | Name of file to be read |
[in] | nskip | Number of rows to skip |
[out] | n | Number of data rows |
[out] | status | Error status |
|
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.
[in] | line | Line to be read |
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.
[in] | outputtype | time- or map-file |
[in] | variablename | code for variable; to be name of file |
[in] | areaagg | subbasin, upstream or output region variable |
[in] | suffix1 | string file suffix |
[in] | suffix2 | integer file suffix |
[in] | suffix2format | use 6 character suffix instead of three |
[in] | suffix3 | integer suffix for classoutput |
[in] | suffix4 | classgroup name suffix |
[in] | fileend | file ending (default is txt, used for .nc) |
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.
[in] | dir | file directory |
[in] | filename | file name including 4 letter fileending (.txt) |
Algoritm
Go to tgz-file and decompress it in place
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.
[in] | bdate | Begin date of simulation |
[in] | edate | End date of simulation |
[in] | fbdate | Begin date of file |
[in] | fedate | End date of file |
[out] | bcdate | Start date of common period |
[out] | ecdate | End date of common period |
[out] | overlap | Status of overlap |
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.
[in] | file | Name of entity whose array (newstn) is checked (for error message) |
[in] | n | Size of original array |
[in] | oldstn | Original array |
[in] | n2 | Size of new array |
[in] | newstn | New array with possible different number of and order of elements |
[in] | allflag | Status: all stations is to be matched, error if not |
[out] | aindex | Index table for order of newstn compared to oldstn |
[out] | status | Error status |
Algoritm
If the size of arrays is the same: for every element
Elseif the size of arrays is not the same: for every element
subroutine readwrite_routines::get_calendar_from_netcdf_file | ( | type(forcingdatatype), intent(in) | forcobs, |
character(len=*), intent(out) | attvalue | ||
) |
Get calendar from netcdf forcing data file.
[in] | forcobs | data/information for one forcing variable |
[out] | attvalue | time |
Default output
Check if attribute calendar exist
Get calendar attribute
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 | ||
) |
Transform time (in units since date) to date in dateType format.
[in] | time | time in units since specified date |
[in] | timeunit | time resolution/time unit |
[in] | sincedate | specified date time is calculculated from |
[out] | date | time in DateType format |
|
private |
Print one line, separated by TAB (=CHAR(9)) or selected separator and with ndec decimals or nsig signficiant figures.
[in] | per | Time period for date print out or integer print out |
[in] | mlab | Switch for MATLAB format (FALSE ,e.g dates with -; TRUE e.g % before title row) |
[out] | t | The first column data as string |
[in] | id | ID to be used as column 1 (e.g. subid or ensemble number) |
[in] | d | Date to be used as column 1 |
[in] | odate | Start date for output period |
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.
[in] | varstr | Name of variable to be read |
[in] | nc_fileid | file id |
[out] | nc_varid | variable id |
[out] | n_result | error number |
[in] | varstr | Name of variable to be read |
[in] | nc_fileid | file id |
[out] | nc_varid | variable id |
[out] | n_result | error number |
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.
[in] | fileid | id of file |
[in] | ns | number of subbasins (basemodel) |
[in,out] | forcobs | data/information for one forcing variable |
[out] | n_result | error status |
[in] | fileid | id of file |
[in] | ns | number of subbasins (basemodel) |
[in,out] | forcobs | data/information for one forcing variable |
[out] | n_result | error status |
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.
[in] | readnclass | Flag for setting class groups from GeoClass |
[in] | dim | Max number of outputs |
[in,out] | outgroups | Number of classgroups for each output |
[in,out] | ndefgroup | Number of defined class groups |
Count number of classes
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.
[in] | idt | current time step |
[in] | ns | number of subbasins |
[in] | forcobs | data/information on a forcing variable |
[out] | current_value | current value of the forcing variable |
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.
[in] | idt | current time step |
[in] | ns | number of stations |
[in] | obsdata | data/information on a observation variable |
[out] | y | current value of the forcing variable |
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 | ||
) |
[in] | idt | current time step |
[in] | ns | number of stations |
[in] | obsdata | data/information on a forcing variable |
[in,out] | y | current value of the forcing variable |
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 | ||
) |
Transform time (as date) to time (in units since since_date)
[out] | time | time in units since specified date |
[in] | timeunit | time resolution/time unit |
[in] | sincedate | specified date time is calculculated from |
[in] | date | time in DateType format |
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.
[in] | dirf | File directory (forcingdir) and file name |
[in] | varname | Variable name |
[in] | ns | Number of subbasins, basemodel |
[in] | ndt | Number of timesteps in simulation |
[in] | bdate | Begin simulation date |
[in] | edate | End simulation date |
[out] | n_result | Error number |
[in] | dirf | File directory (forcingdir) |
[in] | varname | Variable name |
[in] | ns | Number of subbasins, basemodel |
[in] | ndt | Number of timesteps in simulation |
[in] | bdate | Begin simulation date |
[in] | edate | End simulation date |
[out] | n_result | Error number |
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.
[in] | ndt | Total number of time steps |
[in,out] | forcobs | data/information for one forcing variable |
[out] | n_result | error number |
[in] | ndt | Total number of time steps |
[in,out] | forcobs | data/information for one forcing variable |
[out] | n_result | error number |
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.
[in] | idt | current time step |
[in] | forcobs | data/information for one forcing variable |
[out] | current_date | current date |
subroutine public readwrite_routines::load_one_netcdf_forcing_variable | ( | integer, intent(in) | ncols, |
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.
[in] | ns | Total number of subbasins, basemodel_nsub |
[in] | ndt | Total number of time steps |
[in] | bdate | Begin date of simulation |
[in] | edate | End date of simulation |
[in,out] | forcobs | data/information for one forcing variable |
[out] | n_result | error number |
[in] | ncols | Total number of columns |
[in] | ndt | Total number of timesteps |
[in] | bdate | Begin date of simulation |
[in] | edate | End date of simulation |
[in,out] | forcobs | data/information for one forcing variable |
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.
[in] | ndt | Number of timesteps in simulation |
[in] | bdate | Begin simulation date |
[in] | edate | End simulation date |
[in,out] | obsdata | data/information on a forcing variable |
[out] | x2 | Data, only used when reading all obs to memory |
[out] | n_result | Error number |
[in] | ndt | Number of timesteps in simulation |
[in] | bdate | Begin simulation date |
[in] | edate | End simulation date |
[in,out] | obsdata | data/information on a forcing variable |
[out] | x2 | Data, only used when reading all obs to memory |
[out] | n_result | Error number |
subroutine, public readwrite_routines::log_progress | ( | integer, intent(inout) | oldyear, |
integer, intent(in) | newyear | ||
) |
Log simulation progress to log-file.
[in,out] | oldyear | Year id of last timestep |
[in] | newyear | Year id of current timestep |
subroutine public readwrite_routines::open_netcdf_file_and_get_ids | ( | character(len=*), intent(in) | filepath, |
character(len=*), intent(in) | fname, | ||
real, intent(out) | miss, | ||
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.
[in] | filepath | path and filename |
[in] | fname | variable name |
[out] | missing | value for missing value in this file |
[out] | fileid | id of file |
[out] | varid | id of forcing variable in file |
[out] | nstn | number of stations/columns of forcing variable in file |
[out] | n_result | error code |
[in] | filepath | path and filename |
[in] | fname | variable and file name |
[out] | miss | missing value of file |
[out] | fileid | id of file |
[out] | varid | id of forcing variable in file |
[out] | nstn | number of stations |
[out] | n_result | error code |
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.
[in] | dir | File directory |
[in] | n | Number of subbasins |
[in] | iens | Current simulation |
[in] | runens | Flag for ensemble run |
[in] | allens | Flag for writing all ensemble results |
[in] | ensstat | Flag for writing parallell ensemble files |
[in] | dir | File directory |
[in] | n | Number of data columns (subbasins) |
[in] | iens | Current simulation |
[in] | runens | Flag for ensemble run |
[in] | allens | Flag for writing all ensemble results |
[in] | ensstat | Flag 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
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.
[in] | fileunit | Fileunit for infile |
[in] | infile | Name of file to be read |
[in] | nskip | Number of rows to skip in each file, to start read dates |
[in] | bdate | Begin date |
[out] | status | error number |
subroutine, public readwrite_routines::print_output_information_to_logfile | ( | integer, intent(in) | funit | ) |
Log output information to hyss-file.
[in] | funit | File unit of log-file |
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.
[in] | ffunit | file unit |
[in,out] | next_record | current record of file |
[in] | rowmax | chunk for writing, reclen |
[in] | dim | dimension of array |
[out] | array | array with values to be written |
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.
[in] | ffunit | file unit |
[in] | rowmax | chunk for reading |
[in] | dim | dimension of array |
[out] | array | array with read values |
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.
[in] | ffunit | file unit |
[in] | rowmax | chunk for reading |
[in] | dim | dimension of array |
[out] | array | array with read values |
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, 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.
[in] | funit | Unit for file |
[in] | fname | Error filename |
[in] | maxcol | Maximum number of data columns |
[in] | n | Number of subbasins (rows) |
[in] | mcols | Actual number of columns |
[in] | code | Code for column variable type |
[out] | rindex | Index for column real variables |
[out] | iindex | Index for column integer variables |
[out] | xi | Integer data read from file |
[out] | xr | Real data read from file |
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, 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.
[in] | funit | Unit for file |
[in] | fname | Error filename |
[in] | maxcol | Maximum number of data columns |
[in] | n | Number of subbasins (rows) |
[in] | mcols | Actual number of columns |
[in] | dimstr | Max length of string values |
[in] | code | Code for column variable type |
[out] | rindex | Index for column real variables |
[out] | iindex | Index for column integer variables |
[out] | sindex | Index for column string variables |
[out] | xi | Integer data read from file |
[out] | xr | Real data read from file |
[out] | xs | String data read from file |
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.
[in] | funit | Unit for file |
[in] | maxcol | Maximum number of data columns |
[in] | nstr | Number of characters in heading |
[out] | str | Column headings |
[out] | mcols | Actual number of columns |
[out] | status | Error status |
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.
[in] | line | Line with headings |
[in] | maxcol | Maximum number of data columns |
[in] | nstr | Maximum characters of str |
[out] | str | Column headings |
[out] | mcols | Actual number of columns |
[out] | status | Error status |
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.
[in] | funit | Unit for file |
[in] | infile | Name of file to be read |
[in] | n | Maximum number of identifications |
[out] | x | Identification numbers |
[out] | dmax | Number of combinations read |
Algoritm
Count number of classes (actually nslc include all rows)
Allocate variable for holding class information
Read information of GeoClass.txt
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.
[in] | funit | File unit for file |
[in] | infile | Name of file to be read |
[in] | ncols | Total number of columns |
[out] | varname | column variable name |
[out] | varinfo | column variable pointsource id |
[out] | status | error number |
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.
[in] | funit | Unit of file to be read |
[in] | dimrows | Maximum number of rows |
[in] | ncols | Total number of columns |
[in] | edate | End date of simulation |
[in] | miss | Missing value |
[in] | readdateform | Date-time format of line, one or two strings |
[out] | nrows | Number of rows (number of data read in chosen time period) |
[out] | tx | Dates |
[out] | xall | Matrix with all data in chosen time period |
[out] | status | Status of subroutine |
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).
[in] | fileunit | Fileunit for file being read |
[in] | ncols | Total number of columns |
[in] | miss | missing value |
[in] | readdateform | Date-time format of line, one or two strings |
[out] | d | Date (usually days) |
[out] | y | Matrix with data for current day |
[out] | status | Status of subroutine |
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 | ||
) |
Read one forcingdata for whole simulation period from netcdf file.
[in,out] | forcobs | data/information for one forcing variable |
[in] | dimrows | Maximum number of rows (ndt) |
[in] | ncols | Total number of columns |
[out] | xall | Matrix with all data in chosen time period |
[out] | n_result | Error status |
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.
[in] | linelen | Length of line |
[in] | strlen | Length of string |
[in,out] | pos | Current position on line |
[in] | line | Line to be read |
[out] | str | Read string |
[out] | nostrfound | Empty line, may not be error |
[in] | errstr | Value of str if error |
[in] | keepc | Flag for keeping the capitals |
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.
[in] | linelen | length of line |
[in] | strlen | length of str |
[in] | line | line to be read from position pos |
[out] | str | read column |
[in,out] | pos | position on line |
[out] | ierr | error status |
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.
[in] | linelen | Length of line |
[in] | strlen | Length of string |
[in,out] | pos | Current position on line |
[in] | line | Line to be read |
[out] | str | Read string |
[out] | nostrfound | Empty line, may not be error |
[out] | twostringtimefound | Date and time as two strings (not only date or matlab format) |
[in] | errstr | Value of str if error |
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.
[in] | linelen | Length of line |
[in,out] | pos | Current position on line |
[in] | line | Line to be read |
[out] | exitflag | Flag for doing a exit/cycle after subroutine exit (error or missing value) |
[out] | errorflag | Flag for error in subroutine |
[out] | intvalue | Value read from info.txt line |
[in] | maxvalue | Maximum value, above is an error |
[in] | minvalue | Minimum value, below is increased |
subroutine readwrite_routines::read_one_current_date_netcdf | ( | integer, intent(in) | idt, |
type(forcingdatatype), intent(in) | forcobs, | ||
double precision, intent(out) | date | ||
) |
Read one date from Pobs.nc date variable.
[in] | idt | current time step |
[in] | forcobs | data/information for one forcing variable |
[out] | date | time |
Read time from variable in file for timestep
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.
[in] | line | line of parameter file |
[in] | dim | dimension of parameter type |
[out] | varstr | parameter name |
[out] | values | parameter values |
[out] | nvalues | parameter values read from line |
subroutine, public readwrite_routines::skip_comment_rows | ( | integer, intent(in) | funit, |
integer, intent(in) | ncomment, | ||
integer, intent(out) | status | ||
) |
Read past comment lines.
[in] | funit | Unit for file |
[in] | ncomment | Number of rows to skip |
[out] | status | Error status |
subroutine readwrite_routines::transform_time_since_to_datetype | ( | double precision, intent(in) | time, |
character(len=16), intent(in) | timeunit, | ||
type(datetype), intent(out) | date | ||
) |
Transform time (in units since date) to dateType format.
[in] | time | time in units since specified date |
[in] | timeunit | time resolution/time unit |
[out] | date | time in DateType format |
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.
[in] | ffunit | file unit |
[in,out] | next_record | current record of file |
[in] | rowmax | chunk for writing, reclen? |
[in] | dim | dimension of array |
[in] | array | array with values to be written |
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.
[in] | ffunit | file unit |
[in] | rowmax | chunk for writing |
[in] | dim | dimension of array |
[in] | array | array with values to be written |
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.
[in] | ffunit | file unit |
[in] | rowmax | chunk for writing |
[in] | dim | dimension of array |
[in] | array | array with values to be written |
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.
[in] | model | model version |
[in] | variable | variable short name |
[in] | classes | included classes |
[in] | timestep | timestep of output data |
[in] | unit | unit of data |
Set user specified metadata from info.txt
subroutine, public readwrite_routines::write_commentline_to_file | ( | integer, intent(in) | funit, |
character(len=*), intent(in) | comment | ||
) |
Print one line, left adjusted.
[in] | funit | file unit for print-out |
[in] | comment | comment to be written |
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.
[in] | ncid | File id |
[in] | itime | Time index to write to |
[in] | dim | Number of data values (and ids of file) |
[in] | variable | variable to be written |
[in] | beginseconds | time stamp for output |
[in] | values | Data to be written |
[in] | ncid | File id |
[in] | itime | Current index |
[in] | dim | Number of data values (and ids of file) |
[in] | variable | variable to be written |
[in] | beginseconds | time stamp for output |
[in] | values | Data to be written |
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.
[in] | iout | Unit for print-out (e.g. 6) |
[in] | n | Number of values in vector x |
[in] | x | Values |
[in] | ndec | Number of decimals to be written (rounding to ndec decimals will occurr) |
[in] | nsig | Number of significant figures to be written (alternative to ndec) |
[in] | per | Time period for date print out or integer print out |
[in] | sep | Separator in file, e.g ',' or char(9) [=TAB] |
[in] | abb | Switch for abbreviated format (0=no,e.g 0.1 stays 0.1; 1=yes, e.g 0.1 becomes .1) |
[in] | mlab | Switch for MATLAB format (FALSE ,e.g dates with -; TRUE e.g % before title row) |
[in] | id | ID to be used as column 1 (e.g. subid or ensemble number) |
[in] | d | Date to be used as column 1 |
[in] | odate | Start date for output period |
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))
[in] | funit | current file unit |
[in] | n | number of columns (after first) |
[in] | columnid | id of columns |
[in] | firstcolumn | first column header |
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.
[in] | iout | File unit for print-out |
[in] | n | Number of values in vector x |
[in] | x | Values |
[in] | nsig | Number of significant figures to be written (rounding will occurr) |
[in] | textin | Date or other id for first column |
[in] | separator | Separator in file, e.g ',' or char(9) [=TAB] |
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.
[in] | iout | Unit for print-out |
[in] | n | Number of values in vector x |
[in] | x | Values to be written |
[in] | ndec | Number of decimals to be written (rounding to ndec decimals will occurr) |
[in] | textin | Date or other id for first column |
[in] | separator | Separator in file, e.g ',' or char(9) [=TAB] |
[in] | abb | Switch for abbreviated format (0=no,e.g 0.1 stays 0.1; 1=yes, e.g 0.1 becomes .1) |