jwijffels / RMETAR

A METAR decoder for R users, connecting to mdsplib (METAR Decoder Software Package Library - http://mdsplib.sourceforge.net/)
4 stars 4 forks source link

rhub with ASAN/UBSAN shows we need to fix how to address PartialObscurationAmt/PartialObscurationPhenom/SfcObscuration #13

Closed jwijffels closed 4 years ago

jwijffels commented 4 years ago
>>>>>==================== Running R CMD check
About to run xvfb-run san.sh RMETAR_1.0.0.9000.tar.gz
* installing to library ‘/home/docker/R’
* installing *source* package ‘RMETAR’ ...
** libs
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -Wall -pedantic -mtune=native -c RcppExports.cpp -o RcppExports.o
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2  -c antoi.c -o antoi.o
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2  -c charcmp.c -o charcmp.o
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2  -c decode_metar.c -o decode_metar.o
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2  -c decode_metar_remark.c -o decode_metar_remark.o
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2  -c fracpart.c -o fracpart.o
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2  -c print_decoded_metar.c -o print_decoded_metar.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -Wall -pedantic -mtune=native -c r_decode_metar.cpp -o r_decode_metar.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -Wall -pedantic -mtune=native -c r_helpers.cpp -o r_helpers.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -Wall -pedantic -mtune=native -c r_listbuilder.cpp -o r_listbuilder.o
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2  -c stspack2.c -o stspack2.o
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -I"/usr/local/lib/R/include" -DNDEBUG  -I"/home/docker/R/Rcpp/include" -I/usr/local/include   -fpic  -g -O2  -c stspack3.c -o stspack3.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++11 -shared -L/usr/local/lib/R/lib -L/usr/local/lib -o RMETAR.so RcppExports.o antoi.o charcmp.o decode_metar.o decode_metar_remark.o fracpart.o print_decoded_metar.o r_decode_metar.o r_helpers.o r_listbuilder.o stspack2.o stspack3.o -L/usr/local/lib/R/lib -lR
installing to /home/docker/R/RMETAR/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RMETAR)
Running tests

R Under development (unstable) (2018-06-20 r74924) -- "Unsuffered Consequences"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> tools:::.runPackageTestsR()

  Running ‘tinytest.R’

R Under development (unstable) (2018-06-20 r74924) -- "Unsuffered Consequences"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> if(requireNamespace("tinytest", quietly=TRUE)){
+   tinytest::test_package("RMETAR")
+ }
Loading required package: RMETAR

Running test_decode.R.................    0 tests r_decode_metar.cpp:84:59: runtime error: index 3 out of bounds for type 'char [2][7]'
r_decode_metar.cpp:88:62: runtime error: index 3 out of bounds for type 'char [2][12]'
r_decode_metar.cpp:92:52: runtime error: index 7 out of bounds for type 'char [6][10]'

Running test_decode.R.................    1 tests OK
Running test_decode.R.................    2 tests OK
Running test_decode.R.................    3 tests OK
> 
> proc.time()
   user  system elapsed 
  0.360   0.208   0.500 
Running examples
> tools:::.createExdotR('RMETAR', system.file(package = 'RMETAR'))
  Extracting from parsed Rd's 
> 
> 
r_decode_metar.cpp:84:59: runtime error: index 3 out of bounds for type 'char [2][7]'
r_decode_metar.cpp:88:62: runtime error: index 3 out of bounds for type 'char [2][12]'
r_decode_metar.cpp:92:52: runtime error: index 7 out of bounds for type 'char [6][10]'
Classes ‘decodedMETAR’ and 'data.frame':    1 obs. of  193 variables:
 $ synoptic_cloud_type        : chr NA
 $ snow_depth_group           : chr NA
 $ codeName                   : chr NA
 $ stnid                      : chr "KSUU"
 $ horiz_vsby                 : chr NA
 $ dir_min_horiz_vsby         : chr NA
 $ vsby_Dir                   : chr NA
 $ WxObstruct_0               : chr NA
 $ WxObstruct_1               : chr NA
 $ WxObstruct_2               : chr NA
 $ WxObstruct_3               : chr NA
 $ WxObstruct_4               : chr NA
 $ WxObstruct_5               : chr NA
 $ WxObstruct_6               : chr NA
 $ WxObstruct_7               : chr NA
 $ autoIndicator              : chr "AO2"
 $ VSBY_2ndSite_LOC           : chr NA
 $ SKY_2ndSite_LOC            : chr "a\x80\xbf\xff\177"
 $ SKY_2ndSite                : chr "\x95\xd6U"
 $ SectorVsby_Dir             : chr NA
 $ ObscurAloft                : chr NA
 $ ObscurAloftSkyCond         : chr NA
 $ VrbSkyBelow                : chr NA
 $ VrbSkyAbove                : chr NA
 $ LTG_DIR                    : chr NA
 $ CloudLowMediumHigh         : chr NA
 $ CIG_2ndSite_LOC            : chr NA
 $ VIRGA_DIR                  : chr NA
 $ TornadicType               : chr NA
 $ TornadicLOC                : chr NA
 $ TornadicDIR                : chr NA
 $ TornadicMovDir             : chr NA
 $ CHINO_LOC                  : chr NA
 $ VISNO_LOC                  : chr NA
 $ PartialObscurationAmt_0    : chr NA
 $ PartialObscurationAmt_1    : chr NA
 $ PartialObscurationAmt_2    : chr NA
 $ PartialObscurationAmt_3    : chr NA
 $ PartialObscurationAmt_4    : chr NA
 $ PartialObscurationAmt_5    : chr NA
 $ PartialObscurationAmt_6    : chr NA
 $ PartialObscurationPhenom_0 : chr NA
 $ PartialObscurationPhenom_1 : chr NA
 $ PartialObscurationPhenom_2 : chr NA
 $ PartialObscurationPhenom_3 : chr NA
 $ PartialObscurationPhenom_4 : chr NA
 $ PartialObscurationPhenom_5 : chr NA
 $ PartialObscurationPhenom_6 : chr NA
 $ PartialObscurationPhenom_7 : chr NA
 $ PartialObscurationPhenom_8 : chr NA
 $ PartialObscurationPhenom_9 : chr NA
 $ PartialObscurationPhenom_10: chr NA
 $ PartialObscurationPhenom_11: chr NA
 $ SfcObscuration_0           : chr NA
 $ SfcObscuration_1           : chr NA
 $ SfcObscuration_2           : chr NA
 $ SfcObscuration_3           : chr NA
 $ SfcObscuration_4           : chr NA
 $ SfcObscuration_5           : chr NA
 $ SfcObscuration_6           : chr NA
 $ SfcObscuration_7           : chr NA
 $ SfcObscuration_8           : chr "U"
 $ SfcObscuration_9           : chr NA
 $ TS_LOC                     : chr NA
 $ TS_MOVMNT                  : chr NA
 $ Indeterminant3_6HrPrecip   : logi FALSE
 $ Indeterminant_24HrPrecip   : logi FALSE
 $ CIGNO                      : logi FALSE
 $ SLPNO                      : logi TRUE
 $ ACFTMSHP                   : logi TRUE
 $ NOSPECI                    : logi FALSE
 $ FIRST                      : logi TRUE
 $ LAST                       : logi FALSE
 $ SunSensorOut               : logi FALSE
 $ AUTO                       : logi TRUE
 $ COR                        : logi FALSE
 $ NIL_rpt                    : logi FALSE
 $ CAVOK                      : logi FALSE
 $ RVRNO                      : logi TRUE
 $ A_altstng                  : logi TRUE
 $ Q_altstng                  : logi FALSE
 $ VIRGA                      : logi FALSE
 $ VOLCASH                    : logi FALSE
 $ GR                         : logi FALSE
 $ CHINO                      : logi FALSE
 $ VISNO                      : logi FALSE
 $ PNO                        : logi FALSE
 $ PWINO                      : logi FALSE
 $ FZRANO                     : logi FALSE
 $ TSNO                       : logi FALSE
 $ DollarSign                 : logi FALSE
 $ PRESRR                     : logi FALSE
 $ PRESFR                     : logi FALSE
 $ Wshft_FROPA                : logi FALSE
 $ OCNL_LTG                   : logi FALSE
 $ FRQ_LTG                    : logi FALSE
 $ CNS_LTG                    : logi FALSE
 $ CG_LTG                     : logi FALSE
 $ IC_LTG                     : logi FALSE
 $ CC_LTG                     : logi FALSE
 $ CA_LTG                     : logi FALSE
 $ DSNT_LTG                   : logi FALSE
 $ AP_LTG                     : logi FALSE
 $ VcyStn_LTG                 : logi FALSE
 $ OVHD_LTG                   : logi FALSE
 $ LightningVCTS              : logi FALSE
 $ LightningTS                : logi FALSE
 $ visibilityIsUpperBound     : logi FALSE
 $ TornadicDistance           : int NA
 $ ob_hour                    : int 8
 $ ob_minute                  : int 58
 $ ob_date                    : int 24
 $ minWnDir                   : int NA
 $ maxWnDir                   : int NA
 $ VertVsby                   : int NA
 $ temp                       : int 18
 $ dew_pt_temp                : int 12
 $ QFE                        : int NA
 $ hectoPasc_altstng          : int NA
 $ char_prestndcy             : int 8
 $ minCeiling                 : int NA
 $ maxCeiling                 : int NA
 $ WshfTime_hour              : int NA
 $ WshfTime_minute            : int NA
 $ min_vrbl_wind_dir          : int NA
 $ max_vrbl_wind_dir          : int NA
 $ PKWND_dir                  : int NA
 $ PKWND_speed                : int NA
 $ PKWND_hour                 : int NA
 $ PKWND_minute               : int NA
 $ SKY_2ndSite_Meters         : int 0
 $ Ceiling                    : int NA
 $ Estimated_Ceiling          : int NA
 $ SNINCR                     : int NA
 $ SNINCR_TotalDepth          : int NA
 $ SunshineDur                : int NA
 $ ObscurAloftHgt             : int NA
 $ VrbSkyLayerHgt             : int NA
 $ Num8thsSkyObscured         : int NA
 $ CIG_2ndSite_Meters         : int NA
 $ snow_depth                 : int NA
 $ BTornadicHour              : int NA
 $ BTornadicMinute            : int NA
 $ ETornadicHour              : int NA
 $ ETornadicMinute            : int NA
 $ SectorVsby                 : num NA
 $ WaterEquivSnow             : num NA
 $ VSBY_2ndSite               : num NA
 $ prevail_vsbySM             : num 10
 $ prevail_vsbyM              : num NA
 $ prevail_vsbyKM             : num NA
 $ prestndcy                  : num 0.3
 $ precip_amt                 : num NA
 $ precip_24_amt              : num NA
 $ maxtemp                    : num NA
 $ mintemp                    : num NA
 $ max24temp                  : num NA
 $ min24temp                  : num NA
 $ minVsby                    : num NA
 $ maxVsby                    : num NA
 $ hourlyPrecip               : num NA
 $ TWR_VSBY                   : num NA
 $ SFC_VSBY                   : num NA
 $ Temp_2_tenths              : num 17.5
 $ DP_Temp_2_tenths           : num 12.4
 $ SLP                        : num NA
 $ GR_Size                    : num NA
 $ inches_altstng             : num 29.9
 $ Runway_VisRange_0          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_1          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_2          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_3          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_4          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_5          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_6          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_7          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_8          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_9          :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_10         :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Runway_VisRange_11         :List of 8
  ..$ runway_designator: chr NA
  ..$ vrbl_visRange    : logi FALSE
  ..$ below_min_RVR    : logi FALSE
  ..$ above_max_RVR    : logi FALSE
  ..$ visRange         : int NA
  ..$ Max_visRange     : int NA
  ..$ Min_visRange     : int NA
  ..$ Distance_Unit    : chr "meters"
 $ Dispatch_VisRange          :List of 6
  ..$ vrbl_visRange: logi FALSE
  ..$ below_min_DVR: logi FALSE
  ..$ above_max_DVR: logi FALSE
  ..$ visRange     : int NA
  ..$ Max_visRange : int NA
  ..$ Min_visRange : int NA
 $ Recent_Wx_0                :List of 5
  ..$ Recent_weather: chr NA
  ..$ Bhh           : int NA
  ..$ Bmm           : int NA
  ..$ Ehh           : int NA
  ..$ Emm           : int NA
 $ Recent_Wx_1                :List of 5
  ..$ Recent_weather: chr NA
  ..$ Bhh           : int NA
  ..$ Bmm           : int NA
  ..$ Ehh           : int NA
  ..$ Emm           : int NA
 $ Recent_Wx_2                :List of 5
  ..$ Recent_weather: chr NA
  ..$ Bhh           : int NA
  ..$ Bmm           : int NA
  ..$ Ehh           : int NA
  ..$ Emm           : int NA
 $ windstruct                 :List of 5
  ..$ windUnits: chr "KT"
  ..$ windVRB  : logi FALSE
  ..$ windDir  : int 240
  ..$ windSpeed: int 18
  ..$ windGust : int NA
 $ Cloud_Conditions_0         :List of 4
  ..$ cloud_type      : chr "CLR"
  ..$ cloud_hgt_char  : chr NA
  ..$ other_cld_phenom: chr NA
  ..$ cloud_hgt_meters: int NA
 $ Cloud_Conditions_1         :List of 4
  ..$ cloud_type      : chr NA
  ..$ cloud_hgt_char  : chr NA
  ..$ other_cld_phenom: chr NA
  ..$ cloud_hgt_meters: int NA
 $ Cloud_Conditions_2         :List of 4
  ..$ cloud_type      : chr NA
  ..$ cloud_hgt_char  : chr NA
  ..$ other_cld_phenom: chr NA
  ..$ cloud_hgt_meters: int NA
 $ Cloud_Conditions_3         :List of 4
  ..$ cloud_type      : chr NA
  ..$ cloud_hgt_char  : chr NA
  ..$ other_cld_phenom: chr NA
  ..$ cloud_hgt_meters: int NA
 $ Cloud_Conditions_4         :List of 4
  ..$ cloud_type      : chr NA
  ..$ cloud_hgt_char  : chr NA
  ..$ other_cld_phenom: chr NA
  ..$ cloud_hgt_meters: int NA
 $ Cloud_Conditions_5         :List of 4
  ..$ cloud_type      : chr NA
  ..$ cloud_hgt_char  : chr NA
  ..$ other_cld_phenom: chr NA
  ..$ cloud_hgt_meters: int NA
 $ METAR                      : chr "KSUU 240858Z AUTO 24018KT 10SM CLR 18/12 A2988 RMK AO2 SLPNO T01750124 58003 RVRNO"
 $ printout                   : chr "\n\n\n/*******************************************/\n/*    THE DECODED METAR REPORT FOLLOWS     */\n/**********"| __truncated__

/*******************************************/
/*    THE DECODED METAR REPORT FOLLOWS     */
/*******************************************/

STATION ID          : KSUU
OBSERVATION DAY     : 24
OBSERVATION HOUR    : 8
OBSERVATION MINUTE  : 58
AUTO REPORT         : TRUE
WIND DIRECTION      : 240
WIND SPEED          : 18
WIND UNITS          : KT
PREVAIL VSBY (SM)   : 10.000
RVRNO               : TRUE
CLOUD COVER         : CLR
TEMP. (CELSIUS)     : 18
D.P. TEMP. (CELSIUS): 12
ALTIMETER (INCHES)  : 29.88
AUTO INDICATOR      : AO2
SLPNO               : TRUE
TMP2TENTHS (CELSIUS): 17.5
DPT2TENTHS (CELSIUS): 12.4
CHAR PRESS TENDENCY : 8
PRES. TENDENCY (hPa): 0.3

Started importing https://tgftp.nws.noaa.gov/data/observations/metar/cycles/12Z.TXT
Extracting the METAR information
Time elapsed:  0.936 0.136 2.774 0 0 
null device 
          1 
Running vignette code
> tools::buildVignettes(dir = '.', tangle = TRUE)
> 
> 
>>>>>==================== Done with R CMD check
jwijffels commented 4 years ago

Probably need to replace

for(int i=0; i<7; i++){
    var = "PartialObscurationAmt_"  + std::to_string(i+1);
    z.add(var,  string_or_na(Mptr->PartialObscurationAmt[i]));
  }
  for(int i=0; i<12; i++){
    var = "PartialObscurationPhenom_"  + std::to_string(i+1);
    z.add(var,  string_or_na(Mptr->PartialObscurationPhenom[i]));
  }
  for(int i=0; i<10; i++){
    var = "SfcObscuration_"  + std::to_string(i+1);
    z.add(var,  string_or_na(Mptr->SfcObscuration[i]));
  }

with

for(int i=0; i<MAX_PARTIAL_OBSCURATIONS; i++){
    var = "PartialObscurationAmt_"  + std::to_string(i+1);
    z.add(var,  string_or_na(Mptr->PartialObscurationAmt[i]));
  }
  for(int i=0; i<MAX_PARTIAL_OBSCURATIONS; i++){
    var = "PartialObscurationPhenom_"  + std::to_string(i+1);
    z.add(var,  string_or_na(Mptr->PartialObscurationPhenom[i]));
  }
  for(int i=0; i<MAX_SURFACE_OBSCURATIONS; i++){
    var = "SfcObscuration_"  + std::to_string(i+1);
    z.add(var,  string_or_na(Mptr->SfcObscuration[i]));
  }
andrie commented 4 years ago

Agreed. I've fixed this and have submitted a test against r-hub.

andrie commented 4 years ago

Tests pass on R-hub

jwijffels commented 4 years ago

Great.