00001
00002
00003 #ifndef _LIBASTRO_H
00004 #define _LIBASTRO_H
00005
00006 #include "drms.h"
00007 #include "cmdparams.h"
00008
00009 #define kALLDATAMISSING 0
00010 #define kMaxRecQuery 128
00011
00012 typedef enum
00013 {
00014 kLIBASTRO_InterBilinear = 0,
00015 kLIBASTRO_InterCubic = 1,
00016 } LIBASTRO_Interpolation_t;
00017
00018 typedef enum
00019 {
00020 kLIBASTRO_Success = 0,
00021 kLIBASTRO_BadDimensionality,
00022 kLIBASTRO_BadData,
00023 kLIBASTRO_CouldntCreateData,
00024 kLIBASTRO_DimensionMismatch,
00025 kLIBASTRO_CantDoOddNumLats,
00026 kLIBASTRO_UnsupportedInterp,
00027 kLIBASTRO_UnsupportedMCOR,
00028 kLIBASTRO_UnsupportedVCOR,
00029 kLIBASTRO_InconsistentConstraints,
00030 kLIBASTRO_InvalidArgs,
00031 kLIBASTRO_Interpolation,
00032 kLIBASTRO_InsufficientData,
00033 kLIBASTRO_Internal,
00034 kLIBASTRO_OutOfMemory,
00035 kLIBASTRO_DbStatement
00036 } LIBASTRO_Error_t;
00037
00038
00039 int ConvAndInterpFDS(DRMS_Env_t *drmsEnv, char *seriesName, char *dateRange);
00040
00041 float Ccint2(float *f, int nx, int ny, double x, double y);
00042 double Ccint2d(double *f, int nx, int ny, double x, double y);
00043 float Linint2(float *f, int nx, int ny, double x, double y);
00044 double Linint2d(double *f, int nx, int ny, double x, double y);
00045 int Regrid(DRMS_Array_t **dataArr, int *new_length, LIBASTRO_Interpolation_t scheme);
00046 float Imaginterp(DRMS_Segment_t *img, double x, double y);
00047
00048
00049 enum IORBIT_Alg_enum
00050 {
00051 IORBIT_Alg_Linear = 0,
00052 IORBIT_Alg_Quadratic
00053 };
00054
00055 typedef enum IORBIT_Alg_enum IORBIT_Alg_t;
00056
00057 enum IORBIT_CacheAction_enum
00058 {
00059 kIORBIT_CacheAction_None = 0,
00060 kIORBIT_CacheAction_Flush,
00061 kIORBIT_CacheAction_DontCache
00062 };
00063
00064 typedef enum IORBIT_CacheAction_enum IORBIT_CacheAction_t;
00065
00066
00067 struct IORBIT_Info_struct
00068 {
00069 double obstime;
00070 double hciX;
00071 double hciY;
00072 double hciZ;
00073 double hciVX;
00074 double hciVY;
00075 double hciVZ;
00076 double gciX;
00077 double gciY;
00078 double gciZ;
00079 double gciVX;
00080 double gciVY;
00081 double gciVZ;
00082 double dsun_obs;
00083 double rsun_obs;
00084 double obs_vr;
00085 double obs_vw;
00086 double obs_vn;
00087 double crln_obs;
00088 double crlt_obs;
00089 int car_rot;
00090 char orb_rec[kMaxRecQuery];
00091 };
00092
00093 typedef struct IORBIT_Info_struct IORBIT_Info_t;
00094
00095
00096 #define IORBIT_SAAHLZINFO_TIME_KEY_LEN 64
00097 #define IORBIT_SAAHLZINFO_KW_EVENT_TYPE "eventType"
00098 #define IORBIT_SAAHLZINFO_KW_LEN 32
00099 #define IORBIT_SAAHLZINFO_KW_EVENT_TYPE_VALUE_LEN 8
00100
00101 typedef HContainer_t IORBIT_SaaHlzInfo_t;
00102
00103
00104 LIBASTRO_Error_t iorbit_test(DRMS_Env_t *env, const char *orbseries);
00105 void iorbit_carrcoords(TIME t, double obsdist, double b, double hci_long, int *crot, double *L, double *B);
00106 LIBASTRO_Error_t iorbit_getinfo(DRMS_Env_t *env,
00107 const char *srcseries,
00108 const char *optfilter,
00109 IORBIT_Alg_t alg,
00110 const double *tgttimes,
00111 int nitems,
00112 IORBIT_CacheAction_t ctype,
00113 IORBIT_Info_t **info);
00114 LIBASTRO_Error_t iorbit_getinfo_ext(DRMS_Env_t *env,
00115 const char *srcseries,
00116 const char *optfilter,
00117 IORBIT_Alg_t alg,
00118 const double *tgttimes,
00119 int nitems,
00120 IORBIT_CacheAction_t ctype,
00121 IORBIT_Info_t **info,
00122 HContainer_t *keymap);
00123 LIBASTRO_Error_t iorbit_getSaaHlzInfo(DRMS_Env_t *env,
00124 const char *series,
00125 const double *tgttimes,
00126 int nitems,
00127 IORBIT_SaaHlzInfo_t **info);
00128
00129 void iorbit_cleanup();
00130 void iorbit_cleanSaaHlzInfo(IORBIT_SaaHlzInfo_t **info);
00131
00132 void HeliographicLocation(TIME t, int *crot, double *L, double *B);
00133 TIME HeliographicTime(int crot, double L);
00134
00135
00136 #endif // _DRMS_LIBASTRO_H
00137