Skip to content

Commit

Permalink
Merge pull request #2372 from dtcenter/bugfix_2370_aeronetv3
Browse files Browse the repository at this point in the history
Bugfix 2370 aeronetv3
  • Loading branch information
hsoh-u authored Dec 9, 2022
2 parents e81cf04 + b0141b0 commit 7bfbc1e
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 84 deletions.
12 changes: 12 additions & 0 deletions internal/test_unit/xml/unit_aeronet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@
</output>
</test>

<test name="ascii2nc_AERONET_v3_concat">
<exec>&MET_BIN;/ascii2nc</exec>
<param> \
&DATA_DIR_OBS;/aeronet/20221202.v3.lev15.txt \
&OUTPUT_DIR;/aeronet/20221202.v3.lev15.nc \
-v 1 -format aeronetv3
</param>
<output>
<point_nc>&OUTPUT_DIR;/aeronet/20221202.v3.lev15.nc</point_nc>
</output>
</test>

<test name="ascii2nc_AERONET_vld_thresh">
<exec>&MET_BIN;/ascii2nc</exec>
<env>
Expand Down
30 changes: 30 additions & 0 deletions src/basic/vx_cal/unix_to_mdyhms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ using namespace std;

#include <iostream>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <cmath>

Expand Down Expand Up @@ -94,6 +95,35 @@ const char * short_month_name[] = {
};


////////////////////////////////////////////////////////////////////////
// Converts a month string to month (1 to 12).

int month_name_to_m (const char *month_str)

{

int month = -1;
int str_len = strlen(month_str);
char t_month_str[str_len + 1];

for (int idx=0; idx<str_len; idx++) {
t_month_str[idx] = (idx==0) ? toupper(month_str[idx]) : tolower(month_str[idx]);
}
t_month_str[str_len] = 0;

for (int idx=1; idx<=12; idx++) {
if (0 == strcmp(short_month_name[idx], t_month_str)
|| 0 == strcmp(month_name[idx], t_month_str)) {
month = idx;
break;
}
}

return month;

}


////////////////////////////////////////////////////////////////////////


Expand Down
1 change: 1 addition & 0 deletions src/basic/vx_cal/vx_cal.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ extern unixtime doyhms_to_unix (int doy, int year, int hour, int minute, int
extern unixtime mdyhms_to_unix (int month, int day, int year, int hour, int minute, int second);

extern void unix_to_mdyhms (unixtime u, int & month, int & day, int & year, int & hour, int & minute, int & second);
extern int month_name_to_m (const char *month_str);


extern int date_to_mjd (int m, int d, int y);
Expand Down
Loading

0 comments on commit 7bfbc1e

Please sign in to comment.