Skip to content

Commit 1a1f7d9

Browse files
max-zilladlebauer
authored andcommitted
Merge latest hyperspectral code (#43)
* fixed zn/senith nearest neighbour * fixed strftime() typeo fixed sun_flg to Yes * cst_cnv_trg2.nc split into shade(am) and direct sunlight(pm)
1 parent 8afee96 commit 1a1f7d9

4 files changed

Lines changed: 20 additions & 10 deletions

File tree

hyperspectral/cst_cnv_trg2_am.nc

9.29 MB
Binary file not shown.

hyperspectral/cst_cnv_trg2_pm.nc

3.82 MB
Binary file not shown.

hyperspectral/cst_cnv_trg_mk.nco

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
*t_sz=$time2.size;
1414
*min_idx=0;
1515
for(*idx=0 ; idx<t_sz; idx++)
16-
if( zenith(idx)-zd <min)
16+
if( fabs(zenith(idx)-zd) <min)
1717
{
18-
min=zenith(idx)-zd;
18+
min=fabs(zenith(idx)-zd);
1919
min_idx=idx;
2020
}
21-
*zi=min_idx;
21+
22+
zi=min_idx;
2223

2324

2425

hyperspectral/hyperspectral_workflow.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -639,15 +639,17 @@ for ((fl_idx=0;fl_idx<${fl_nbr};fl_idx++)); do
639639
if [ "${flg_vnir}" = 'Yes' ]; then
640640

641641
if [ "${new_clb_flg}" = 'Yes' ]; then
642+
643+
sun_flg='Yes'
642644
#grab first zenith angle from jsn merged data from above
643645
zn=$( ncks -s "%f" -H -d time,0 -v solar_zenith_angle "${jsn_out}" )
644646
if [ "$?" -ne 0 ]; then
645647
printf "${spt_nm}: ERROR Failed to grab first calibration angle. from \"${jsn_out}\""
646648
exit 1
647-
fi
649+
fi
648650

649651
# get timestamp from frametime
650-
timestamp_for_ncks=$( ncap2 -v -O -s 'timestamp=strftime(frametime(0),"%Y-%m-%d %H:%m");print(timestamp,"%s");' "$jsn_out" "/tmp/foo_$$.nc")
652+
timestamp_for_ncks=$( ncap2 -v -O -s 'timestamp=strftime(frametime(0),"%Y-%m-%d %H:%M");print(timestamp,"%s");' "$jsn_out" "/tmp/foo_$$.nc")
651653
if [ "$?" -ne 0 ]; then
652654
printf "${spt_nm}: ERROR Failed to grab first timestamp from \"frametime(0) in \"${jsn_out}\""
653655
exit 1
@@ -676,10 +678,17 @@ for ((fl_idx=0;fl_idx<${fl_nbr};fl_idx++)); do
676678
ncks -A "${drc_spt}/theblob.nc" "${att_out}"
677679
[ "$?" -ne 0 ] && echo "$0: problem copying theblob\n" && exit 1
678680

679-
# for now the target is hard coded to 48%
680-
ncap2 -A -v -s "*zd=${zn} ;*trg=48; *expr=${xps_tm};" -S "${drc_spt}/cst_cnv_trg_mk.nco" "${drc_spt}/cst_cnv_trg.nc" "${att_out}"
681-
[ "$?" -ne 0 ] && echo "$0: problem getting cst_cnv_trg from nc file \n" && exit 1
682-
681+
682+
if [ "$sun_flg" = "Yes" ]; then
683+
# use the pm targets - these are in bright sunlight - target fixed at 48 %
684+
ncap2 -A -v -s "*zd=${zn} ;*trg=48; *expr=${xps_tm};" -S "${drc_spt}/cst_cnv_trg_mk.nco" "${drc_spt}/cst_cnv_trg2_pm.nc" "${att_out}"
685+
[ "$?" -ne 0 ] && echo "$0: problem getting cst_cnv_trg from nc file \n" && exit 1
686+
else
687+
# use the am targets - these are in in the shade of the gantry
688+
ncap2 -A -v -s "*zd=${zn} ;*trg=48; *expr=${xps_tm};" -S "${drc_spt}/cst_cnv_trg_mk.nco" "${drc_spt}/cst_cnv_trg2_am.nc" "${att_out}"
689+
[ "$?" -ne 0 ] && echo "$0: problem getting cst_cnv_trg from nc file \n" && exit 1
690+
fi
691+
683692
# copy flx_spc_dwn from environmental logger
684693
ncks -A -C -v flx_spc_dwn -d time,"$timestamp_for_ncks" "$envlog_fl" "${att_out}"
685694
[ "$?" -ne 0 ] && echo "$0: problem extracting env-log from $envlog_fl \n" && exit 1
@@ -831,7 +840,7 @@ for ((fl_idx=0;fl_idx<${fl_nbr};fl_idx++)); do
831840
echo "WARNING addition of the var \"SoilRemovalMask\" from the file \"${msk_fl}\" failed. Possibly the dims x, y in this file dont match the data dims. x=${xdm_nbr}, y=${ydm_nbr}"
832841
fi
833842
fi
834-
843+
835844
hsi_in=${clb_out}
836845
hsi_out="${out_fl/.nc/_ind.nc}"
837846
printf "hsi(in) : ${hsi_in}\n"

0 commit comments

Comments
 (0)