Previous: Arrays of datasets, Up: Library data container [Contents][Index]
The functions in this section describes Gnuastro’s facilities to copy a
given dataset into another. The new dataset can have a different type
(including a string), it can be already allocated (in which case only the
values will be written into it). In all these cases, if the input dataset
is a tile or a list, only the data within the given tile, or the given node
in a list, are copied. If the input is a list, the next
pointer will
also be copied to the output, see List of gal_data_t
.
In many of the functions here, it is possible to copy the dataset to a new numeric data type (see Numeric data types. In such cases, Gnuastro’s library is going to use the native conversion by C. So if you are converting to a smaller type, it is up to you to make sure that the values fit into the output type.
*in
)Return a new dataset that is a copy of in
, all of in
’s
meta-data will also copied into the output, except for block
. If the
dataset is a tile/list, only the given tile/node will be copied, the
next
pointer will also be copied however.
*in
, uint8_t newtype
)Return a copy of the dataset in
, converted to newtype
, see
Library data types (type.h) for Gnuastro library’s type identifiers. The
returned dataset will have all meta-data except their type and block
equal to the input’s metadata. If the dataset is a tile/list, only the
given tile/node will be copied, the next
pointer will also be copied
however.
*in
, uint8_t newtype
)Return a copy of the dataset in
that is converted to newtype
and free the input dataset. See Library data types (type.h) for Gnuastro
library’s type identifiers. The returned dataset will have all meta-data,
except their type, equal to the input’s metadata (including
next
). Note that if the input is a tile within a larger block, it
will not be freed. This function is similar to
gal_data_copy_to_new_type
, except that it will free the input
dataset.
*in
, gal_data_t *out
)Copy the contents of the array in in
into the already allocated
array in out
. The types of the input and output may be different,
type conversion will be done internally. When in->size != out->size
this function will behave as follows:
out->size < in->size
This function won’t re-allocate the necessary space, it will abort with an error, so please check before calling this function.
out->size > in->size
This function will write the values in out->size
and
out->dsize
from the same values of in
. So if you want to use
a pre-allocated space/dataset multiple times with varying input sizes, be
sure to reset out->size
before every call to this function.
*string
)Read string
into the smallest type that can store the value (see
Numeric data types). This function is just a wrapper for the
gal_type_string_to_number
, but will put the value into a
single-element dataset.
Previous: Arrays of datasets, Up: Library data container [Contents][Index]
GNU Astronomy Utilities 0.13 manual, September 2020.