htmie

Optical properties of water droplets
git clone git://git.meso-star.fr/htmie.git
Log | Files | Refs | README | LICENSE

commit a4c9a214fcfbd759afcff54c5386cb3a50ebebdf
parent b11f770522e8daf2335a37aad0f4a9cfe868b02e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 14 Nov 2018 11:59:10 +0100

Do not load the rmod & smod variable anymore

Diffstat:
Msrc/htmie.c | 104-------------------------------------------------------------------------------
1 file changed, 0 insertions(+), 104 deletions(-)

diff --git a/src/htmie.c b/src/htmie.c @@ -50,9 +50,6 @@ struct htmie { struct darray_double xsections_scattering; /* In m^2.kg^-1 */ struct darray_double g; /* Asymetric parameter */ - double rmod; /* Modal mean radius of droplet in micro-meters */ - double smod; /* Modal std dev of droplet size in micro-meters */ - int verbose; /* Verbosity level */ struct logger* logger; struct mem_allocator* allocator; @@ -261,79 +258,6 @@ error: } static res_T -load_droplet_distribution_variable - (struct htmie* htmie, - const int nc, - const char* var_name, - const double range[2], - double* value) -{ - size_t start; - size_t len; - int id; - int ndims; - int dimid; - int err = NC_NOERR; - int type; - res_T res = RES_OK; - ASSERT(htmie && nc != INVALID_NC_ID && range && var_name && value); - ASSERT(range[0] <= range[1]); - - err = nc_inq_varid(nc, var_name, &id); - if(err != NC_NOERR) { - log_err(htmie, "Could not inquire the '%s' variable -- %s\n", - var_name, ncerr_to_str(err)); - res = RES_BAD_ARG; - goto error; - } - - NC(inq_varndims(nc, id, &ndims)); - if(ndims != 1) { - log_err(htmie, - "The dimension of the '%s' variable must be 1.\n", var_name); - res = RES_BAD_ARG; - goto error; - } - - NC(inq_vardimid(nc, id, &dimid)); - NC(inq_dimlen(nc, dimid, &len)); - if(len != 1) { - log_err(htmie, - "Only 1 distribution is currently supported while the #distributions of " - "the '%s' variable is %lu\n", var_name, (unsigned long)len); - res = RES_BAD_ARG; - goto error; - } - - NC(inq_vartype(nc, id, &type)); - if(type != NC_DOUBLE && type != NC_FLOAT) { - log_err(htmie, - "The type of the '%s' variable cannot be %s. " - "Expecting floating point data.\n", - var_name, nctype_to_str(type)); - res = RES_BAD_ARG; - goto error; - } - - start = 0; - NC(get_vara_double(nc, id, &start, &len, value)); - - if(*value < range[0] || *value > range[1]) { - log_err(htmie, - "Invalid droplet distribution variable '%s = %g'. " - "It must be in [%g, %g]\n", - var_name, var_name, *value, range[0], range[1]); - res = RES_BAD_ARG; - goto error; - } - -exit: - return res; -error: - goto exit; -} - -static res_T load_distrib_x_lambda_array (struct htmie* htmie, const int nc, @@ -434,30 +358,6 @@ error: goto exit; } -static INLINE res_T -massic_to_per_particle_xsections - (const struct htmie* htmie, - struct darray_double* xsections) -{ - double radius_barre; - double avg_volume; - size_t i; - res_T res = RES_OK; - ASSERT(htmie && xsections); - - /* Convert data from massic cross sections to per particle cross sections */ - radius_barre = exp(htmie->rmod); /* in micrometer */ - avg_volume = /* in micrometer^3 */ - 4.0/3.0 * PI * radius_barre*radius_barre*radius_barre - * exp(4.5*htmie->smod*htmie->smod); - - FOR_EACH(i, 0, darray_double_size_get(xsections)) { - double* d = darray_double_data_get(xsections); - d[i] = d[i] * avg_volume * 1.e-15; /* in m^2/particle */ - } - return res; -} - static FINLINE double interpolate_data (const struct htmie* htmie, @@ -722,10 +622,6 @@ htmie_load(struct htmie* htmie, const char* path) #define CALL(Func) { res = Func; if(res != RES_OK) goto error; } (void)0 CALL(load_wavelengths(htmie, nc, range)); - CALL(load_droplet_distribution_variable - (htmie, nc, "rmod", range, &htmie->rmod)); - CALL(load_droplet_distribution_variable - (htmie, nc, "smod", range, &htmie->smod)); CALL(load_distrib_x_lambda_array (htmie, nc, "macs", range, &htmie->xsections_absorption)); CALL(load_distrib_x_lambda_array