nbren12 / geostreams

Streaming data from fortran climate/weather models.
7 stars 3 forks source link

Discuss details for C/Fortran API #7

Open nbren12 opened 7 years ago

nbren12 commented 7 years ago

Send one array

F:

[i,d,f]redis_push(....)

C: void Redis_push(redisConnnection * c, void * f, int dtype, int * dims, int ndims, char * KEY);

PUBLISH subscription_key KEY

nbren12 commented 7 years ago

The current sig I am using is

void Redis_push(redisContext * c, void * f, const char* dtype, int * dims, 
                            int ndims, char * KEY);

Now, I just to find a way to wrap the pointer to the redisContext object in fortran. This link has some useful information about dealing with c pointers.

nbren12 commented 7 years ago

The current fortran API is

call redis_push(redis, 'A', f, 'f4', shape(f))

I cannot figure out anyway to make redis_push handle different types, and avoid manually passing shape(f).

jhamman commented 7 years ago

I think we can get the API slimmed down to: redis_push(c, key, arr) through the use of a few interfaces. I'll open a proof of concept PR here shortly.

nbren12 commented 7 years ago

That'd be great. I don't have much experience with fortran polymorphism. At some point we should probably check for the endianness of the data, and just pass it like '<f8' or '>f8'.

jhamman commented 7 years ago

I just opened #13 which address this and the endianness issue.