Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RS41 - dew point #26

Closed
pavolgaj opened this issue Dec 5, 2020 · 2 comments
Closed

RS41 - dew point #26

pavolgaj opened this issue Dec 5, 2020 · 2 comments

Comments

@pavolgaj
Copy link

pavolgaj commented Dec 5, 2020

It would be useful to have also a dew point value in the output if "--ptu" option is used. I don't know if this value is directly in data from radiosonde or it could be only calculated from temperature and humidity.

@rs1729
Copy link
Owner

rs1729 commented Dec 5, 2020

Sorry, but I didn't want to include too many derived values, same with AUX-O3-data or pressure altitude. Maybe I will change my mind one day, but for now, maybe you include it yourself if you want that output. You can look how it is calculated here:
https://en.wikipedia.org/wiki/Dew_point
or look at
https://github.com/einergehtnochrein/ra-firmware/blob/master/src/rs41/rs41metrology.c#L262
You could change prn_ptu()
https://github.com/rs1729/RS/blob/master/demod/mod/rs41mod.c#L1446
and add dew point calculation like this:

static int prn_ptu(gpx_t *gpx) {
    fprintf(stdout, " ");
    if (gpx->T > -273.0) fprintf(stdout, " T=%.1fC ", gpx->T);
    if (gpx->RH > -0.5)  fprintf(stdout, " RH=%.0f%% ", gpx->RH);
    if (gpx->P > 0.0) {
        if (gpx->P < 100.0) fprintf(stdout, " P=%.2fhPa ", gpx->P);
        else                fprintf(stdout, " P=%.1fhPa ", gpx->P);
    }
    if (gpx->option.ptu == 2) {
        if (gpx->RH2 > -0.5)  fprintf(stdout, " RH2=%.0f%% ", gpx->RH2);
    }

    // dew point
    float rh = gpx->RH;
    float Td = -273.15f; // dew point Td
    if (gpx->option.ptu == 2) rh = gpx->RH2;
    if (rh > 0.0f && gpx->T > -273.0f) {
        float gamma = logf(rh / 100.0f) + (17.625f * gpx->T / (243.04f + gpx->T));
        Td = 243.04f * gamma / (17.625f - gamma);
        fprintf(stdout, " Td=%.1fC ", Td);
    }
    return 0;
}

Hm... maybe I include it as an additional option...

@rs1729
Copy link
Owner

rs1729 commented Dec 27, 2020

rs41mod: added dew point option "--dewp" (don't forget "--ptu" or "--ptu2" resp.)

@rs1729 rs1729 closed this as completed Dec 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants