#include <stdio.h>
#include <glib.h>
#include <sed/sed_hydro.h>
Go to the source code of this file.
Classes | |
struct | Sed_hydrotrend_header |
Defines | |
#define | SED_HYDROTREND_ERROR sed_hydrotrend_error_quark() |
Enumerations | |
enum | Sed_hydrotrend_error { SED_HYDROTREND_ERROR_BAD_HEADER } |
Functions | |
Sed_hydrotrend_header * | sed_hydrotrend_read_header (FILE *fp) |
Sed_hydrotrend_header * | sed_hydrotrend_read_header_from_byte_order (FILE *fp, gint order) |
Sed_hydrotrend_header * | sed_hydrotrend_header_destroy (Sed_hydrotrend_header *h) |
Sed_hydrotrend_header * | sed_hydrotrend_join_header_from_byte_order (FILE **fp_list, gint order, GError **err) |
gssize | sed_hydrotrend_write_header_to_byte_order (FILE *fp, gint n_grains, gint n_seasons, gint n_samples, gchar *comment_s, gint order) |
gssize | sed_hydrotrend_write_header (FILE *fp, gint n_grains, gint n_seasons, gint n_samples, gchar *comment_s) |
gint | sed_hydrotrend_byte_order (const gchar *file, GError **error) |
gint | sed_hydrotrend_guess_byte_order (FILE *fp) |
Sed_hydro | sed_hydrotrend_read_next_rec (FILE *fp, int n_grains) |
Sed_hydro | sed_hydrotrend_read_next_rec_from_byte_order (FILE *fp, int n_grains, gint order) |
Sed_hydro * | sed_hydrotrend_read_recs (FILE *fp, gint rec_0, gint n_recs, gint byte_order, GError **error) |
gssize | sed_hydrotrend_read_next_n_recs (FILE *fp, Sed_hydro *rec, int n_grains, int n_recs) |
Sed_hydro * | sed_hydrotrend_read (const gchar *file, gint byte_order, int *n_seasons, GError **error) |
Sed_hydro * | sed_hydrotrend_read_n_recs (const gchar *file, gint n_recs, gint byte_order, int *n_seasons, GError **error) |
gssize | sed_hydrotrend_write_record (FILE *fp, Sed_hydro rec) |
gssize | sed_hydrotrend_write_record_to_byte_order (FILE *fp, Sed_hydro rec, gint order) |
gssize | sed_hydrotrend_write (gchar *file, Sed_hydro *rec_a, gint n_seasons, gchar *comment_s, GError **error) |
gssize | sed_hydro_array_write_hydrotrend_records_to_byte_order (FILE *fp, Sed_hydro *rec_a, gint order) |
gssize | sed_hydro_array_write_hydrotrend_records (FILE *fp, Sed_hydro *rec_a) |
gint | sed_hydrotrend_fseek (FILE *fp, gint offset, gint whence, gint byte_order) |
gint | sed_hydrotrend_record_size (FILE *fp, gint byte_order, Sed_hydrotrend_header *h) |
gint | sed_hydrotrend_n_grains (FILE *fp, gint byte_order, Sed_hydrotrend_header *h) |
gint | sed_hydrotrend_data_start (FILE *fp, gint byte_order, Sed_hydrotrend_header *h) |
#define SED_HYDROTREND_ERROR sed_hydrotrend_error_quark() |
Definition at line 42 of file sed_hydrotrend.h.
Referenced by sed_hydrotrend_join_header_from_byte_order().
enum Sed_hydrotrend_error |
gssize sed_hydro_array_write_hydrotrend_records | ( | FILE * | fp, | |
Sed_hydro * | rec_a | |||
) |
Write records to a HydroTrend file
fp | A HydroTrend file | |
rec_a | A NULL-terminated array of Sed_hydro records |
Definition at line 577 of file sed_hydrotrend.c.
References sed_hydro_array_write_hydrotrend_records_to_byte_order().
Referenced by sed_hydrotrend_write().
gssize sed_hydro_array_write_hydrotrend_records_to_byte_order | ( | FILE * | fp, | |
Sed_hydro * | rec_a, | |||
gint | order | |||
) |
Definition at line 554 of file sed_hydrotrend.c.
References sed_hydrotrend_write_record_to_byte_order().
Referenced by sed_hydro_array_write_hydrotrend_records().
gint sed_hydrotrend_byte_order | ( | const gchar * | file, | |
GError ** | error | |||
) |
Definition at line 223 of file sed_hydrotrend.c.
References Sed_hydrotrend_header::comment, eh_fopen_error(), eh_free, eh_require, and sed_hydrotrend_read_header_from_byte_order().
gint sed_hydrotrend_data_start | ( | FILE * | fp, | |
gint | byte_order, | |||
Sed_hydrotrend_header * | h | |||
) |
The file position that marks the start of the data
fp | A HydroTrend file | |
byte_order | The byte order of the HydroTrend file | |
h | The header info for the file (or NULL) |
Definition at line 717 of file sed_hydrotrend.c.
References eh_free, eh_require, and sed_hydrotrend_read_header_from_byte_order().
Referenced by sed_hydrotrend_fseek().
gint sed_hydrotrend_fseek | ( | FILE * | fp, | |
gint | offset, | |||
gint | whence, | |||
gint | byte_order | |||
) |
Reposition a file-position indicator of a HydroTrend file
Set the file-position indicator for a HydroTrend file. This has two major differences from the standard fseek function. (1) The offset is measured in records rather than bytes. (2) The new position withing the file is returned (in records).
For example:
sed_hydro_fseek( fp , 0 , SEEK_SET )
moves the file-position indicator to the start of the data.
sed_hydro_fseek( fp , 365 , SEEK_SET )
moves the file-position indicator to the 365th record in the file.
fp | A HydroTrend file | |
offset | The offset (in HydroTrend records) to move | |
whence | Where offset is measured from | |
byte_order | The byte order of the HydroTrend file |
Definition at line 609 of file sed_hydrotrend.c.
References sed_hydrotrend_data_start(), and sed_hydrotrend_record_size().
Referenced by sed_hydrotrend_read_recs().
gint sed_hydrotrend_guess_byte_order | ( | FILE * | fp | ) |
Sed_hydrotrend_header* sed_hydrotrend_header_destroy | ( | Sed_hydrotrend_header * | h | ) |
Definition at line 139 of file sed_hydrotrend.c.
References Sed_hydrotrend_header::comment, and eh_free.
Referenced by main(), and sed_hydrotrend_read_header_from_byte_order().
Sed_hydrotrend_header* sed_hydrotrend_join_header_from_byte_order | ( | FILE ** | fp_list, | |
gint | order, | |||
GError ** | err | |||
) |
Definition at line 81 of file sed_hydrotrend.c.
References Sed_hydrotrend_header::comment, eh_free, eh_return_val_if_fail, Sed_hydrotrend_header::n_grains, Sed_hydrotrend_header::n_samples, Sed_hydrotrend_header::n_seasons, SED_HYDROTREND_ERROR, SED_HYDROTREND_ERROR_BAD_HEADER, and sed_hydrotrend_read_header_from_byte_order().
Referenced by main().
gint sed_hydrotrend_n_grains | ( | FILE * | fp, | |
gint | byte_order, | |||
Sed_hydrotrend_header * | h | |||
) |
The number of suspended grains of a HydroTrend record
fp | A pointer to a HydroTrend file | |
byte_order | The byte order of the HydroTrend file | |
h | The header information if known, NULL otherwise |
Definition at line 677 of file sed_hydrotrend.c.
References eh_free, eh_require, and sed_hydrotrend_read_header_from_byte_order().
Referenced by sed_hydrotrend_read_recs().
Sed_hydro* sed_hydrotrend_read | ( | const gchar * | file, | |
gint | byte_order, | |||
int * | n_seasons, | |||
GError ** | error | |||
) |
Sed_hydrotrend_header* sed_hydrotrend_read_header | ( | FILE * | fp | ) |
Read the header of a HydroTrend file.
fp | The file to read. |
Definition at line 22 of file sed_hydrotrend.c.
References sed_hydrotrend_read_header_from_byte_order().
Sed_hydrotrend_header* sed_hydrotrend_read_header_from_byte_order | ( | FILE * | fp, | |
gint | order | |||
) |
Read the header of a HydroTrend file with a specific byte order
fp | The file to read. | |
order | The byte order of the file |
Definition at line 35 of file sed_hydrotrend.c.
References Sed_hydrotrend_header::comment, eh_fread_int32_swap, eh_free, eh_new, Sed_hydrotrend_header::n_grains, Sed_hydrotrend_header::n_samples, Sed_hydrotrend_header::n_seasons, and sed_hydrotrend_header_destroy().
Referenced by main(), sed_hydrotrend_byte_order(), sed_hydrotrend_data_start(), sed_hydrotrend_join_header_from_byte_order(), sed_hydrotrend_n_grains(), sed_hydrotrend_read_header(), sed_hydrotrend_read_n_recs(), and sed_hydrotrend_record_size().
Sed_hydro* sed_hydrotrend_read_n_recs | ( | const gchar * | file, | |
gint | n_recs, | |||
gint | byte_order, | |||
int * | n_seasons, | |||
GError ** | error | |||
) |
Definition at line 462 of file sed_hydrotrend.c.
References Sed_hydrotrend_header::comment, eh_fopen_error(), eh_free, eh_return_val_if_fail, Sed_hydrotrend_header::n_samples, Sed_hydrotrend_header::n_seasons, sed_hydrotrend_read_header_from_byte_order(), and sed_hydrotrend_read_recs().
Referenced by sed_hydro_file_guess_type(), and sed_hydrotrend_read().
gssize sed_hydrotrend_read_next_n_recs | ( | FILE * | fp, | |
Sed_hydro * | rec, | |||
int | n_grains, | |||
int | n_recs | |||
) |
Read a series of HydroTrend records
fp | The file to read from | |
rec | The location to put the records | |
n_grains | The number of suspended grain sizes. | |
n_recs | The number of records to read. |
Definition at line 442 of file sed_hydrotrend.c.
References sed_hydrotrend_read_next_rec().
Sed_hydro sed_hydrotrend_read_next_rec | ( | FILE * | fp, | |
int | n_grains | |||
) |
Read one record from a HydroTrend file.
fp | The file to read | |
n_grains | The number of suspended grains in the file |
Definition at line 299 of file sed_hydrotrend.c.
References sed_hydrotrend_read_next_rec_from_byte_order().
Referenced by sed_hydro_file_fill_buffer(), and sed_hydrotrend_read_next_n_recs().
Sed_hydro sed_hydrotrend_read_next_rec_from_byte_order | ( | FILE * | fp, | |
int | n_grains, | |||
gint | order | |||
) |
Read a Sed_hydro from a HydroTrend file of a specific byte order
fp | A HydroTrend file | |
n_grains | Number of suspended grains in the Sed_hydro | |
order | The byte order to write |
Definition at line 314 of file sed_hydrotrend.c.
References eh_fread_flt_swap, eh_free, eh_new, sed_hydro_new(), sed_hydro_set_bedload(), sed_hydro_set_depth(), sed_hydro_set_nth_concentration(), sed_hydro_set_velocity(), and sed_hydro_set_width().
Referenced by sed_hydrotrend_read_next_rec(), and sed_hydrotrend_read_recs().
Sed_hydro* sed_hydrotrend_read_recs | ( | FILE * | fp, | |
gint | rec_0, | |||
gint | n_recs, | |||
gint | byte_order, | |||
GError ** | error | |||
) |
Read a range of records from a HydroTrend file
fp | A HydroTrend file | |
rec_0 | The first record to read (starting from 0) | |
n_recs | The number of records to read | |
byte_order | The byte order of the hydroTrend file | |
error | A GError |
Definition at line 353 of file sed_hydrotrend.c.
References eh_new, eh_require, eh_return_val_if_fail, sed_hydrotrend_fseek(), sed_hydrotrend_n_grains(), and sed_hydrotrend_read_next_rec_from_byte_order().
Referenced by main(), and sed_hydrotrend_read_n_recs().
gint sed_hydrotrend_record_size | ( | FILE * | fp, | |
gint | byte_order, | |||
Sed_hydrotrend_header * | h | |||
) |
The size of a HydroTrend record in bytes
fp | A pointer to a HydroTrend file | |
byte_order | The byte order of the HydroTrend file | |
h | The header information if known, NULL otherwise |
Definition at line 638 of file sed_hydrotrend.c.
References eh_free, eh_require, and sed_hydrotrend_read_header_from_byte_order().
Referenced by sed_hydrotrend_fseek().
gssize sed_hydrotrend_write | ( | gchar * | file, | |
Sed_hydro * | rec_a, | |||
gint | n_seasons, | |||
gchar * | comment_s, | |||
GError ** | error | |||
) |
Write a complete HydroTrend file
file | The name of the file | |
rec_a | A NULL-terminated array of Sed_hydro records | |
n_seasons | The number of "seasons" used for the HydroTrend file | |
comment_s | A comment string (or NULL) | |
error | A GError |
Definition at line 524 of file sed_hydrotrend.c.
References eh_fopen_error(), eh_require, eh_return_val_if_fail, sed_hydro_array_write_hydrotrend_records(), sed_hydro_size(), and sed_hydrotrend_write_header().
gssize sed_hydrotrend_write_header | ( | FILE * | fp, | |
gint | n_grains, | |||
gint | n_seasons, | |||
gint | n_samples, | |||
gchar * | comment_s | |||
) |
Write the header of a HydroTrend file
fp | A HydroTrend file | |
n_grains | Number of suspended grains | |
n_seasons | Number of "seasons" for the HydroTrend file | |
n_samples | Number of records | |
comment_s | String containing a comment (or NULL) |
Definition at line 194 of file sed_hydrotrend.c.
Referenced by sed_hydrotrend_write().
gssize sed_hydrotrend_write_header_to_byte_order | ( | FILE * | fp, | |
gint | n_grains, | |||
gint | n_seasons, | |||
gint | n_samples, | |||
gchar * | comment_s, | |||
gint | order | |||
) |
Definition at line 150 of file sed_hydrotrend.c.
References eh_fwrite_int32_swap.
Referenced by main().
gssize sed_hydrotrend_write_record | ( | FILE * | fp, | |
Sed_hydro | rec | |||
) |
Write a Sed_hydro to a HydroTrend file
fp | A HydroTrend file | |
rec | A Sed_hydro to write |
Definition at line 389 of file sed_hydrotrend.c.
References sed_hydrotrend_write_record_to_byte_order().
gssize sed_hydrotrend_write_record_to_byte_order | ( | FILE * | fp, | |
Sed_hydro | rec, | |||
gint | order | |||
) |
Write a Sed_hydro to a HydroTrend file with a specific byte order
fp | A HydroTrend file | |
rec | A Sed_hydro to write | |
order | The byte order to write |
Definition at line 403 of file sed_hydrotrend.c.
References eh_free, eh_fwrite_flt_swap, eh_new, sed_hydro_bedload(), sed_hydro_depth(), sed_hydro_nth_concentration(), sed_hydro_size(), sed_hydro_velocity(), and sed_hydro_width().
Referenced by sed_hydro_array_write_hydrotrend_records_to_byte_order(), and sed_hydrotrend_write_record().