; NAME: ; GIRO_READ_OUTPUT ; ; PURPOSE: ; Reading the output of the GIRO application and compose a structure ; usable in IDL ; ; CATEGORY ; NONE ; ; CALLING SEQUENCE: ; GIRO_READ_OUTPUT, sSat = sSat, stROLO_Res_NCDF = stROLO_Res_NCDF ; (ex. GIRO_READ_OUTPUT, sSat = 'MSG1', stROLO_Res_NCDF = stROLO_Res_MSG1) ; ; INPUTS: ; ; sSat = Satellite name as used as an input for the GIRO executable ; ; OUTPUTS: ; ; stROLO_Res_NCDF = Structure in which the output is stored ; ; RESTRICTIONS: ; ; MODIFICATION HISTORY: ; Written by : Bartolomeo Viticchie - August 2014 ; pro GIRO_READ_OUTPUT, sSat = sSat, stROLO_Res_NCDF = stROLO_Res_NCDF ; Folder containing the output of the GIRO executable sNCDF_Folder = "./results/" ; Looking for the output file sFile_Names = file_search(sNCDF_Folder + '*' + sSat + '*.nc') ; Opening the NetCDF file to read ; (if multiple files are available the first one is used) iNCDF_id = NCDF_OPEN( sFile_Names[0], /NOWRITE) ; ==== In the NetCDF file ==== ; Getting the useful dimensions iDIM_id = NCDF_DIMID(iNCDF_id,'chan') NCDF_DIMINQ, iNCDF_id, iDIM_id, sName, lChans iDIM_id = NCDF_DIMID(iNCDF_id,'date') NCDF_DIMINQ, iNCDF_id, iDIM_id, sName, lFiles iDIM_id = NCDF_DIMID(iNCDF_id,'lambda_rolo') NCDF_DIMINQ, iNCDF_id, iDIM_id, sName, lROLO_Lambdas iDIM_id = NCDF_DIMID(iNCDF_id,'lambda_apollo') NCDF_DIMINQ, iNCDF_id, iDIM_id, sName, lAPO_Lambdas ; Getting the variables iVAR_id = NCDF_VARID(iNCDF_id,'channel_name') NCDF_VARGET,iNCDF_id,iVAR_id,bChans sChans = string(bChans) iVAR_id = NCDF_VARID(iNCDF_id,'central_wavelength') NCDF_VARGET,iNCDF_id,iVAR_id,dChan_Cen_Wls iVAR_id = NCDF_VARID(iNCDF_id,'moon_obs_file') NCDF_VARGET,iNCDF_id,iVAR_id,bFiles_ROLO sFiles_ROLO = string(bFiles_ROLO) iVAR_id = NCDF_VARID(iNCDF_id,'irr_obs') NCDF_VARGET,iNCDF_id,iVAR_id,dObs_Irr_Archives iVAR_id = NCDF_VARID(iNCDF_id,'dc_obs') NCDF_VARGET,iNCDF_id,iVAR_id,lTot_DC_Archives dTot_DC_Archives=double(lTot_DC_Archives) iVAR_id = NCDF_VARID(iNCDF_id,'dc_obs_offset') NCDF_VARGET,iNCDF_id,iVAR_id,dOff_DC_Archives iVAR_id = NCDF_VARID(iNCDF_id,'moon_pix_num') NCDF_VARGET,iNCDF_id,iVAR_id,lMask_Thld_Pixels_Archives iVAR_id = NCDF_VARID(iNCDF_id,'moon_pix_thld') NCDF_VARGET,iNCDF_id,iVAR_id,iThld_Archives iVAR_id = NCDF_VARID(iNCDF_id,'sat_selen_lon') NCDF_VARGET,iNCDF_id,iVAR_id,dLon_Sat_Archive iVAR_id = NCDF_VARID(iNCDF_id,'sat_selen_lat') NCDF_VARGET,iNCDF_id,iVAR_id,dLat_Sat_Archive iVAR_id = NCDF_VARID(iNCDF_id,'dist_sat_moon') NCDF_VARGET,iNCDF_id,iVAR_id,dDis_Sat_Archive iVAR_id = NCDF_VARID(iNCDF_id,'sun_selen_lon') NCDF_VARGET,iNCDF_id,iVAR_id,dLon_SUN_Archive iVAR_id = NCDF_VARID(iNCDF_id,'sun_selen_lat') NCDF_VARGET,iNCDF_id,iVAR_id,dLat_SUN_Archive iVAR_id = NCDF_VARID(iNCDF_id,'dist_sun_moon') NCDF_VARGET,iNCDF_id,iVAR_id,dDis_SUN_Archive iVAR_id = NCDF_VARID(iNCDF_id,'phase_ang') NCDF_VARGET,iNCDF_id,iVAR_id,dPhaseAngle_Sat_Archive iVAR_id = NCDF_VARID(iNCDF_id,'rolo_spectr') NCDF_VARGET,iNCDF_id,iVAR_id,drefl_ROLO_Archives iVAR_id = NCDF_VARID(iNCDF_id,'rolo_smooth_spectr') NCDF_VARGET,iNCDF_id,iVAR_id,dCorr_APO_Archives iVAR_id = NCDF_VARID(iNCDF_id,'irr_rolo') NCDF_VARGET,iNCDF_id,iVAR_id,dROLO_Irr_Chan_Archives ; Splitting the info from the different channels for cc=0,lChans-1 do begin sChan = sChans[cc] dChan_Cen_Wl = dChan_Cen_Wls[cc] dObs_Irr_Archive = reform(dObs_Irr_Archives[cc,*]) dTot_DC_Archive = reform(dTot_DC_Archives[cc,*]) dOff_DC_Archive = reform(dOff_DC_Archives[cc,*]) iThld_Archive = reform(lMask_Thld_Pixels_Archives[cc,*]) lMask_Thld_Pixels_Archive= reform(iThld_Archives[cc,*]) dCorr_APO_Archive = reform(dCorr_APO_Archives[*,cc,*]) drefl_ROLO_Archive = reform(drefl_ROLO_Archives[*,cc,*]) dROLO_Irr_Chan_Archive = reform(dROLO_Irr_Chan_Archives[cc,*]) ; Storing in the structure stROLO_Res_Chan = create_struct ( $ 'sCHANNEL_NAME' , sChan, $ 'dCENTRAL_WAV' , dChan_Cen_Wl, $ 'sROLO_FILES' , sFiles_ROLO, $ 'lROLO_FILES' , lFiles, $ 'dOBS_IRRADIANCE' , dObs_Irr_Archive, $ 'dDC_TOTAL' , dTot_DC_Archive, $ 'dDC_OFFSET' , dOff_DC_Archive, $ 'iTHLD' , iThld_Archive, $ 'lTHLD_PIXELS' , lMask_Thld_Pixels_Archive, $ 'dSEL_LAT_SAT' , dLat_Sat_Archive, $ 'dSEL_LON_SAT' , dLon_Sat_Archive, $ 'dSEL_DIS_SAT' , dDis_Sat_Archive, $ 'dPHASE_ANGLE' , dPhaseAngle_Sat_Archive, $ 'dSEL_LAT_SUN' , dLat_SUN_Archive, $ 'dSEL_LON_SUN' , dLon_SUN_Archive, $ 'dSEL_DIS_SUN' , dDis_SUN_Archive, $ 'dROLO_APO_SPECTRA' , dCorr_APO_Archive, $ 'dROLO_SPECTRA' , drefl_ROLO_Archive, $ 'dROLO_IRRADIANCE' , dROLO_Irr_Chan_Archive $ ) ; Appending the content of the different channels if (cc gt 0) then stROLO_Res_NCDF = create_struct ( stROLO_Res_NCDF , 'st'+sSat+'_'+sChan , stROLO_Res_Chan ) else $ stROLO_Res_NCDF = create_struct ( 'st'+sSat+'_'+sChan , stROLO_Res_Chan ) endfor ; Closing the NetCDF file NCDF_CLOSE, iNCDF_id end