gd_framenum_subset(3)
π gd_framenum_subset β bestie, let's reverse-engineer a field π
okay so this is the gd_framenum_subset(3) page from the GETDATA manual, and honestly? it's giving "detective but for numbers". we're doing a reverse look-up on a monotonic dirfile field. iykyk. π΅οΈβοΈβ¨
β¨ NAME β¨
gd_framenum_subset, gd_framenum β perform a reverse look-up on a monotonic dirfile field. periodt. π
π¦ SYNOPSIS π¦
#include <getdata.h>
double gd_framenum_subset(DIRFILE *dirfile, const char *field_code,
double value, off_t field_start, off_t field_end);
double gd_framenum(DIRFILE *dirfile, const char *field_code, double
value);
πΈ DESCRIPTION πΈ
so gd_framenum_subset() queries a dirfile(5) database that you hand it as dirfile, and it gives you back the fractional frame number where the field named by field_code equals value. and field_code? it can totally contain a representation suffix, no big deal. π
but here's the twist β it only looks at the field between the frame limits field_start and field_end. boundaries, bestie. we respect them.
- if
field_startis zero, the frame offset of the field gets used as the lower limit instead. and lowkey? that offset could be zero too β checkgd_frameoffset(3)if you don't believe me. π«Ά - if
field_endis zero, the number of frames in the dirfile gets used as the upper limit instead β that's whatevergd_nframes(3)reports.
and gd_framenum()? it's literally just gd_framenum_subset() with field_start and field_end both set to zero. same energy, fewer arguments. π«
the field must be monotonic (either increasing or decreasing) between the limits you supply. it does not have to be strictly monotonic though. we're chill like that.
interpolation tea β: if the value you're searching for lands between two sample values, the frame number you get back is calculated by linear interpolation of the field between those two samples. and if more than one consecutive sample equals the value you're searching for? you get the fractional frame number of one of those samples, and no, it won't tell you which one. mystery behaviour, honestly iconic. π
extrapolation tea π«: if the value you're searching for is found to lie outside the supplied limits, the first two or last two samples of the field get used to linearly extrapolate the returned frame number. and if those two samples happen to have the same value? you get positive or negative infinity. π
when extrapolating, this function will never consider data outside the supplied limits, even if such data exists. as a result, the extrapolated value may differ greatly from the value considering all the data. no cap, that's just how it is.
all computation is done in double precision. so if you use this on a 64-bit integer field with more precision than a double precision floating point number can hold, your returned value may be inaccurate. π
trying to use this function on a complex valued field = error. and if the field is constant across the entire range, that's an error too β even if the value you're searching for is equal to the constant value of the field. the disrespect of it all.
π RETURN VALUE π
on success, these functions return the fractional frame number at which the given function would attain the supplied value, based only on that portion of the field between the given limits. and bestie, this might be any number β even values outside of the supplied limits, all the way up to and including positive or negative infinity. β¨
on error, these functions return an IEEE-754 conforming not-a-number (NaN), and store a negative-valued error code in the DIRFILE object, which you can retrieve with a subsequent call to gd_error(3). the possible error codes are:
GD_E_ALLOCβ the library was unable to allocate memory. πGD_E_BAD_CODEβ the field specified byfield_codewas not found. girl, where.GD_E_BAD_DIRFILEβ the supplied dirfile was invalid. π©GD_E_BAD_SCALARβ a scalar field used in the definition of the field was not found, or was not of scalar type.GD_E_DIMENSIONβ the field specified byfield_codewas not a vector field. Or, a scalar field was found where a vector field was expected in the definition of the field or one of its inputs.GD_E_DOMAINβ the specified field was complex valued, or the supplied frame range was too small. This error may also arise if data is deleted from the field as the function is executing. π³GD_E_INTERNAL_ERRORβ an internal error occurred in the library while trying to perform the task. This indicates a bug in the library. Please report the incident to the maintainer. fr fr, they wanna know.GD_E_IOβ an error occurred while trying to open or read from a file on disk containing a raw field or LINTERP table.GD_E_LUTβ a LINTERP table was malformed. not the malformed LINTERP table πGD_E_RANGEβ the specified field is constant between the supplied limits.GD_E_RECURSE_LEVELβ too many levels of recursion were encountered while trying to resolvefield_code. This usually indicates a circular dependency in field specification in the dirfile. πGD_E_UNKNOWN_ENCODINGβ the encoding scheme of a RAW field could not be determined. This may also indicate that the binary file associated with the RAW field could not be found.GD_E_UNSUPPORTEDβ reading from dirfiles with the encoding scheme of the specified dirfile is not supported by the library. Seedirfile-encoding(5)for details on dirfile encoding schemes.
and a descriptive error string for the error may be obtained by calling gd_error_string(3). slay, now you know what went wrong. π
π HISTORY π
the get_framenum() and get_framenum_subset() functions appeared in GetData-0.6.0. glow-up era.
in GetData-0.7.0, these functions were renamed to gd_framenum() and gd_framenum_subset(). rebrand of the century, honestly. π
π SEE ALSO π
Version 0.10.0 Β· 25 December 2016 β that's the source, the version, and the date, bestie, and that's the whole page. go forth and reverse look-up. mwah. ππ¦β¨
π¦ where this page comes from
- debian bookworm: libgetdata-doc 0.11.0-6
- debian trixie: libgetdata-doc 0.11.0-15
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- nixos 26.05: getdata 0.11.0
- nixpkgs unstable: getdata 0.11.0
- ubuntu jammy: libgetdata-doc 0.11.0-3ubuntu1
- ubuntu noble: libgetdata-doc 0.11.0-13
- ubuntu questing: libgetdata-doc 0.11.0-15
- ubuntu resolute: libgetdata-doc 0.11.0-17build1
- ubuntu stonking: libgetdata-doc 0.11.0-17build2
- Copyright (C) 2016 D. V. Wiebe
- Copyright (C) 2009, 2010, 2011, 2014, 2016 D.V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms