SCS reformat data: These files contain combined data from SOJ and JamMet files, averaged to 1-min. Reformatted SOJ and JamMet files with headers were loaded and processed with the following IgorPro script. function FormatJamMetFile() // formats data and writes 30 sec output file SetDataFolder root: // assumes JamMet and Nav files have been read into the root folder wave JAM_date_mm_dd_yyyy, JAM_hh_mm_ss, JAM_ORG_mm_hr, JAM_P_hPa wave JAM_Tair_C, JAM_RH, JAM_Rain_mm, JAM_WspdRel_m_s, JAM_WdirRel, JAM_Wspd_m_s wave JAM_Wdir, JAM_Gyro, JAM_SpdLog_kts, JAM_Lat, JAM_Lon, JAM_PSPAvg_W_m2 wave JAM_PIRAvg_W_m2, JAM_PIRu_W_m2, JAM_TCase_C, JAM_TDome_C, JAM_PAR_microE_cm2_sec wave/T JAM_N_S, JAM_W_E wave LocalOffset, YYYY, MO, DD, hh, mm, ss, pdop, Nsats, LatDeg, LatMin, LonDeg wave LonMin, sog_kts, cog, SpdLog, Gyro, AirT_C, SST_C, depth_m, P_hPa_z0, RH, WdirRel wave WspdRel_m_s, Wdir, Wspd_m_s, Rain_mm, Rad_kW_m2, Sal_ppth, GPS_alt_m, Mag_nT wave Grav_mgal, CurrDir, CurrSpd_kts wave/T Datum, NavSrc, NavFlag, LatSign, LonSign variable Npts = 24*60 // number of 1 min periods in the day make/D/O/N=(Npts) SCS_Time, SCS_Lat, SCS_Lon, SCS_RH, SCS_Ta_C, SCS_P_hPa make/D/O/N=(Npts) SCS_rain_mm_hr, SCS_WspdRel_m_s, SCS_WdirRel, SCS_Wspd_m_s, SCS_Wdir make/D/O/N=(Npts) SCS_gyro, SCS_SpdLog_kts, SCS_PSP, SCS_PIR, SCS_PIRu, SCS_Tcase, SCS_Tdome make/D/O/N=(Npts) ship_WspdRel, ship_WdirRel, ship_Wspd, ship_Wdir, ship_Lat, ship_Lon make/D/O/N=(Npts) ship_cog, ship_sog_kts, ship_Ta_C, ship_SST_C, ship_RH, ship_P_hPa_z0 make/D/O/N=(Npts) ship_sal_ppth, ship_currDir, ship_currSpd_kts, ship_spdLog_kts, ship_gyro SetScale/P x JAM_date_mm_dd_yyyy[0],60,"dat", SCS_Time, SCS_Lat, SCS_Lon, SCS_RH, SCS_Ta_C, SCS_P_hPa SetScale/P x JAM_date_mm_dd_yyyy[0],60,"dat", SCS_rain_mm_hr, SCS_WspdRel_m_s, SCS_WdirRel, SCS_Wspd_m_s, SCS_Wdir SetScale/P x JAM_date_mm_dd_yyyy[0],60,"dat", SCS_gyro, SCS_SpdLog_kts, SCS_PSP, SCS_PIR, SCS_PIRu, SCS_Tcase, SCS_Tdome SetScale/P x JAM_date_mm_dd_yyyy[0],60,"dat", ship_WspdRel, ship_WdirRel, ship_Wspd, ship_Wdir, ship_Lat, ship_Lon SetScale/P x JAM_date_mm_dd_yyyy[0],60,"dat", ship_cog, ship_sog_kts, ship_Ta_C, ship_SST_C, ship_RH, ship_P_hPa_z0 SetScale/P x JAM_date_mm_dd_yyyy[0],60,"dat", ship_sal_ppth, ship_currDir, ship_currSpd_kts, ship_spdLog_kts, ship_gyro SetScale d 0,0,"dat", SCS_Time SCS_Time[]=x Duplicate/D/O JAM_date_mm_dd_yyyy JamTimeStamp SetScale d 0,0,"dat", JamTimeStamp JamTimeStamp[] = JAM_date_mm_dd_yyyy[p] + JAM_hh_mm_ss[p] Duplicate/O JAM_Lat JamLatDec JamLatDec[] = trunc(JAM_Lat[p]/100) + mod(JAM_Lat[p],100)/60 JamLatDec[] = (stringmatch(JAM_N_S[p],"N")) ? JamLatDec[p] : -JamLatDec[p] Duplicate/O JAM_Lon JamLonDec JamLonDec[] = trunc(JAM_Lon[p]/100) + mod(JAM_Lon[p],100)/60 JamLonDec[] = (stringmatch(JAM_W_E[p],"E")) ? JamLonDec[p] : -JamLonDec[p] Duplicate/O JAM_WdirRel JamRWdirUnwrap Duplicate/O JAM_Wdir JamWdirUnwrap Duplicate/O JAM_Gyro JamGyroUnwrap Unwrap 360, JamRWdirUnwrap Unwrap 360, JamWdirUnwrap Unwrap 360, JamGyroUnwrap // interpolate to 5 sec gyro data variable Npts_5 = 24*60*12 // number of 5 sec periods in a day Make/D/O/N=(Npts_5) Ship_Heading SetScale/P x JAM_date_mm_dd_yyyy[0],5,"dat", Ship_Heading Duplicate/O Ship_Heading Ship_time Ship_time = (x-date2secs(2013,12,31))/86400 // decimal day of year timestamp Interpolate2 /I=3/T=1/Y=Ship_Heading JamTimeStamp , JamGyroUnwrap Ship_Heading[] = mod(Ship_Heading[p],360) // reformat to 0-360 range Ship_Heading[] = (Ship_Heading[p]<0) ? Ship_Heading[P]+360 : Ship_Heading[p] Ave2xScale(SCS_Lat,JamLatDec,JamTimeStamp) Ave2xScale(SCS_Lon,JamLonDec,JamTimeStamp) Ave2xScale(SCS_RH,JAM_RH,JamTimeStamp) Ave2xScale(SCS_Ta_C,JAM_Tair_C,JamTimeStamp) Ave2xScale(SCS_P_hPa,JAM_P_hPa,JamTimeStamp) Ave2xScale(SCS_rain_mm_hr,JAM_ORG_mm_hr,JamTimeStamp) Ave2xScale(SCS_WspdRel_m_s,JAM_WspdRel_m_s,JamTimeStamp) Ave2xScale(SCS_WdirRel,JamRWdirUnwrap,JamTimeStamp) Ave2xScale(SCS_Wspd_m_s,JAM_Wspd_m_s,JamTimeStamp) Ave2xScale(SCS_Wdir,JamWdirUnwrap,JamTimeStamp) Ave2xScale(SCS_gyro,JamGyroUnwrap,JamTimeStamp) Ave2xScale(SCS_SpdLog_kts,JAM_SpdLog_kts,JamTimeStamp) Ave2xScale(SCS_PSP,JAM_PSPAvg_W_m2,JamTimeStamp) Ave2xScale(SCS_PIR,JAM_PIRAvg_W_m2,JamTimeStamp) Ave2xScale(SCS_PIRu,JAM_PIRu_W_m2,JamTimeStamp) Ave2xScale(SCS_Tcase,JAM_TCase_C,JamTimeStamp) Ave2xScale(SCS_Tdome,JAM_TDome_C,JamTimeStamp) SCS_WdirRel[] = mod(SCS_WdirRel,360) SCS_WdirRel[] = (SCS_WdirRel[p]>180) ? SCS_WdirRel[p]-360 : SCS_WdirRel[p] SCS_WdirRel[] = (SCS_WdirRel[p]<-180) ? SCS_WdirRel[p]+360 : SCS_WdirRel[p] SCS_Wdir[] = mod(SCS_Wdir,360) SCS_Wdir[] = (SCS_Wdir[p]<0) ? SCS_Wdir[p]+360 : SCS_Wdir[p] SCS_gyro[] = mod(SCS_gyro,360) SCS_gyro[] = (SCS_gyro[p]<0) ? SCS_gyro[p]+360 : SCS_gyro[p] Duplicate/O YYYY NavTime, LatDecDeg, LonDecDeg SetScale d 0,0,"dat", NavTime NavTime[] = date2secs(YYYY[p],MO[p],DD[p]) + hh*3600 + mm*60 + ss LatDecDeg[] = LatDeg[p] + LatMin[p]/60 LatDecDeg[] = (stringmatch(LatSign[p],"N")) ? LatDecDeg[p] : -LatDecDeg[p] LonDecDeg[] = LonDeg[p]+LonMin[p]/60 LonDecDeg[] = (stringmatch(LonSign[p],"W")) ? LonDecDeg[p] : -LonDecDeg[p] Duplicate/O WdirRel RWdirUnwrap Duplicate/O Wdir WdirUnwrap Duplicate/O Gyro GyroUnwrap Duplicate/O cog cogUnwrap Duplicate/O CurrDir CurrDirUnwrap Unwrap 360, RWdirUnwrap Unwrap 360, WdirUnwrap Unwrap 360, GyroUnwrap Unwrap 360, cogUnwrap Unwrap 360, CurrDirUnwrap Ave2xScale(ship_Lon,LonDecDeg,NavTime) Ave2xScale(ship_Lat,LatDecDeg,NavTime) Ave2xScale(ship_Wdir,WdirUnwrap,NavTime) Ave2xScale(ship_Wspd,Wspd_m_s,NavTime) Ave2xScale(ship_WdirRel,RWdirUnwrap,NavTime) Ave2xScale(ship_WspdRel,WspdRel_m_s,NavTime) Ave2xScale(ship_P_hPa_z0,P_hPa_z0,NavTime) Ave2xScale(ship_RH,RH,NavTime) Ave2xScale(ship_SST_C,SST_C,NavTime) Ave2xScale(ship_Ta_C,AirT_C,NavTime) Ave2xScale(ship_sog_kts,sog_kts,NavTime) Ave2xScale(ship_cog,cogUnwrap,NavTime) Ave2xScale(ship_spdLog_kts,SpdLog,NavTime) Ave2xScale(ship_currSpd_kts,CurrSpd_kts,NavTime) Ave2xScale(ship_currDir,CurrDirUnwrap,NavTime) Ave2xScale(ship_sal_ppth,Sal_ppth,NavTime) Ave2xScale(ship_gyro,GyroUnwrap,NavTime) ship_Wdir[] = mod(ship_Wdir,360) ship_Wdir[] = (ship_Wdir[p]<0) ? ship_Wdir[p]+360 : ship_Wdir[p] ship_cog[] = mod(ship_cog,360) ship_cog[] = (ship_cog[p]<0) ? ship_cog[p]+360 : ship_cog[p] ship_WdirRel[] = mod(ship_WdirRel,360) ship_WdirRel[] = (ship_WdirRel[p]>180) ? ship_WdirRel[p]-360 : ship_WdirRel[p] ship_WdirRel[] = (ship_WdirRel[p]<-180) ? ship_WdirRel[p]+360 : ship_WdirRel[p] ship_currDir[] = mod(ship_currDir,360) ship_currDir[] = (ship_currDir[p]<0) ? ship_currDir[p]+360 : ship_currDir[p] ship_gyro[] = mod(ship_gyro,360) ship_gyro[] = (ship_gyro[p]<0) ? ship_gyro[p]+360 : ship_gyro[p] // kill bad gps points SCS_Lat[] = (SCS_Lat[p]==0) ? NaN : SCS_Lat[p] SCS_Lon[] = (SCS_Lon[p]==0) ? NaN : SCS_Lon[p] ship_Lat[] = (ship_Lat[p]==0) ? NaN : ship_Lat[p] ship_Lon[] = (ship_Lon[p]==0) ? NaN : ship_Lon[p] Edit/W=(97,117,1224,655)/N=DataTable0 SCS_Time,SCS_Lat,SCS_Lon,SCS_P_hPa,SCS_Ta_C,SCS_RH,SCS_Wdir AppendToTable SCS_Wspd_m_s,SCS_WdirRel,SCS_WspdRel_m_s,SCS_rain_mm_hr,SCS_PIR,SCS_PIRu,SCS_Tcase,SCS_Tdome AppendToTable SCS_SpdLog_kts,SCS_PSP,SCS_gyro,ship_Lat,ship_Lon,ship_Wdir,ship_Wspd,ship_WdirRel AppendToTable ship_WspdRel,ship_P_hPa_z0,ship_Ta_C,ship_RH,ship_SST_C,ship_sal_ppth AppendToTable ship_sog_kts,ship_cog,ship_gyro,ship_spdLog_kts,ship_currSpd_kts,ship_currDir ModifyTable format(Point)=1,format(SCS_Time)=8,width(SCS_Time)=114,format(SCS_Lat)=3 ModifyTable digits(SCS_Lat)=6,format(SCS_Lon)=3,digits(SCS_Lon)=6,format(SCS_P_hPa)=3 ModifyTable digits(SCS_P_hPa)=2,format(SCS_Ta_C)=3,digits(SCS_Ta_C)=2,format(SCS_RH)=3 ModifyTable digits(SCS_RH)=2,format(SCS_Wdir)=3,digits(SCS_Wdir)=2,format(SCS_Wspd_m_s)=3 ModifyTable digits(SCS_Wspd_m_s)=2,format(SCS_WdirRel)=3,digits(SCS_WdirRel)=2,format(SCS_WspdRel_m_s)=3 ModifyTable digits(SCS_WspdRel_m_s)=2,format(SCS_rain_mm_hr)=3,digits(SCS_rain_mm_hr)=2 ModifyTable format(SCS_PIR)=3,digits(SCS_PIR)=2,format(SCS_PIRu)=3,digits(SCS_PIRu)=2 ModifyTable format(SCS_Tcase)=3,digits(SCS_Tcase)=2,format(SCS_Tdome)=3,digits(SCS_Tdome)=2 ModifyTable format(SCS_PSP)=3,digits(SCS_PSP)=2 ModifyTable format(SCS_SpdLog_kts)=3,digits(SCS_SpdLog_kts)=2,format(SCS_gyro)=3 ModifyTable digits(SCS_gyro)=2,format(ship_Lat)=3,digits(ship_Lat)=6,format(ship_Lon)=3 ModifyTable digits(ship_Lon)=6,format(ship_Wdir)=3,digits(ship_Wdir)=2,format(ship_Wspd)=3 ModifyTable digits(ship_Wspd)=2,format(ship_WdirRel)=3,digits(ship_WdirRel)=2,format(ship_WspdRel)=3 ModifyTable digits(ship_WspdRel)=2,format(ship_P_hPa_z0)=3,digits(ship_P_hPa_z0)=2 ModifyTable format(ship_Ta_C)=3,digits(ship_Ta_C)=2,format(ship_RH)=3,digits(ship_RH)=2 ModifyTable format(ship_SST_C)=3,digits(ship_SST_C)=2,format(ship_sal_ppth)=3,digits(ship_sal_ppth)=2 ModifyTable format(ship_sog_kts)=3,digits(ship_sog_kts)=2,format(ship_cog)=3,digits(ship_cog)=2 ModifyTable format(ship_gyro)=3,digits(ship_gyro)=2,format(ship_spdLog_kts)=3,digits(ship_spdLog_kts)=2 ModifyTable format(ship_currSpd_kts)=3,digits(ship_currSpd_kts)=2,format(ship_currDir)=3 ModifyTable digits(ship_currDir)=2 string DOY = num2str(round((SCS_Time[0]-date2secs(YYYY[0]-1,12,31))/86400)) string YY = num2str(YYYY[0]) YY=YY[2,3] string Fname = "scs0"+YY+DOY+"00.txt" String ListStr = "SCS_Time;SCS_Lat;SCS_Lon;SCS_P_hPa;SCS_Ta_C;SCS_RH;SCS_Wdir;SCS_Wspd_m_s;" ListStr += "SCS_WdirRel;SCS_WspdRel_m_s;SCS_rain_mm_hr;SCS_PIR;SCS_PIRu;SCS_Tcase;SCS_Tdome;SCS_PSP;" ListStr += "SCS_SpdLog_kts;SCS_gyro;ship_Lat;ship_Lon;ship_Wdir;ship_Wspd;ship_WdirRel;ship_WspdRel;ship_P_hPa_z0;" ListStr += "ship_Ta_C;ship_RH;ship_SST_C;ship_sal_ppth;ship_sog_kts;ship_cog;ship_gyro;ship_spdLog_kts;" ListStr += "ship_currSpd_kts;ship_currDir;" Save/G/O/W/M="\r\n"/F/B ListStr as Fname KillWindow DataTable0 Edit/W=(91,89,405,500)/N=DataTable0 Ship_time,Ship_Heading ModifyTable format(Point)=1,format(Ship_time)=3,digits(Ship_time)=8,width(Ship_time)=96 ModifyTable format(Ship_Heading)=3 Fname = "lgr0"+YY+DOY+"00.txt" ListStr = "Ship_time;Ship_Heading;" Save/G/O/W/M="\r\n"/F/B ListStr as Fname KillWindow DataTable0 end