Browse Source

Fix MCIR & Temperature

Also improve land color in MCIR images
tags/v1.8.0
Xerbo 4 years ago
parent
commit
175a76054e
2 changed files with 11 additions and 9 deletions
  1. +3
    -3
      main.c
  2. +8
    -6
      pngio.c

+ 3
- 3
main.c View File

@@ -148,7 +148,7 @@ static int processAudio(char *filename, options_t *opts){


if(strcmp(extension, "png") == 0){ if(strcmp(extension, "png") == 0){
// Read PNG into image buffer // Read PNG into image buffer
printf("Reading %s", filename);
printf("Reading %s\n", filename);
if(readRawImage(filename, img.prow, &img.nrow) == 0){ if(readRawImage(filename, img.prow, &img.nrow) == 0){
fprintf(stderr, "Skipping %s; see above.\n", img.name); fprintf(stderr, "Skipping %s; see above.\n", img.name);
return 0; return 0;
@@ -180,7 +180,7 @@ static int processAudio(char *filename, options_t *opts){


if(opts->realtime) closeWriter(); if(opts->realtime) closeWriter();


printf("\nTotal rows: %d\n", img.nrow);
printf("Total rows: %d\n", img.nrow);


// Fallback for detecting the zenith // Fallback for detecting the zenith
// TODO: encode zenith in raw images // TODO: encode zenith in raw images
@@ -215,7 +215,7 @@ static int processAudio(char *filename, options_t *opts){


// MCIR // MCIR
if (CONTAINS(opts->type, 'm')) if (CONTAINS(opts->type, 'm'))
ImageOut(opts, &img, 0, IMG_WIDTH, "MCIR", "m", NULL);
ImageOut(opts, &img, CHA_OFFSET, CH_WIDTH, "MCIR", "m", NULL);


// Linear equalise // Linear equalise
if(CONTAINS(opts->effects, 'l')){ if(CONTAINS(opts->effects, 'l')){


+ 8
- 6
pngio.c View File

@@ -75,6 +75,8 @@ int mapOverlay(char *filename, rgb_t **crow, int nrow, int zenith, int MCIR) {
fclose(fp); fclose(fp);
png_destroy_read_struct(&png, &info, NULL); png_destroy_read_struct(&png, &info, NULL);


printf("Adding map overlay\n");

// Map overlay / MCIR / Precipitation // Map overlay / MCIR / Precipitation
int mapOffset = (height/2)-zenith; int mapOffset = (height/2)-zenith;
for(int y = 0; y < nrow; y++) { for(int y = 0; y < nrow; y++) {
@@ -96,8 +98,8 @@ int mapOverlay(char *filename, rgb_t **crow, int nrow, int zenith, int MCIR) {
if(map.b < 128 && map.g > 128){ if(map.b < 128 && map.g > 128){
// Land // Land
float green = CLIP((map.g-256)/32.0, 0, 1); float green = CLIP((map.g-256)/32.0, 0, 1);
float blue = 1-CLIP((map.b-32)/64.0, 0, 1);
crow[y][cha] = (rgb_t){50 + blue*50, 80 + green*70, 64};
float blue = 1 - CLIP((map.b-32)/64.0, 0, 1);
crow[y][cha] = (rgb_t){blue*127, 30+green*80, 40};
}else{ }else{
// Sea // Sea
crow[y][cha] = (rgb_t){12, 30, 85}; crow[y][cha] = (rgb_t){12, 30, 85};
@@ -275,7 +277,7 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c


// Map stuff // Map stuff
if(opts->map != NULL && opts->map[0] != '\0'){ if(opts->map != NULL && opts->map[0] != '\0'){
if(mapOverlay(opts->map, crow, img->nrow, zenith, strcmp(chid, "MCIR") == 0) == 0){
if(mapOverlay(opts->map, crow, img->nrow, zenith, strcmp(desc, "MCIR") == 0) == 0){
fprintf(stderr, "Skipping MCIR generation; see above.\n"); fprintf(stderr, "Skipping MCIR generation; see above.\n");
return 0; return 0;
} }
@@ -314,9 +316,9 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c
}; };
}else{ }else{
pix[x] = (png_color){ pix[x] = (png_color){
CLIP(crow[y][x + skip + offset].r, 0, 255),
CLIP(crow[y][x + skip + offset].g, 0, 255),
CLIP(crow[y][x + skip + offset].b, 0, 255)
crow[y][x + skip + offset].r,
crow[y][x + skip + offset].g,
crow[y][x + skip + offset].b
}; };
} }
} }


Loading…
Cancel
Save