public List <StationData> MeteoRefill(MissionInfo missionInfo) { if (missionInfo == null & missionInfo.stationInfoFile == null & missionInfo.forecastFilesHead == null & missionInfo.missionID == 0) { return(null); } //读取站点每日数据 List <StationData> stationDataList = ChartProcess.DailyFileRead(missionInfo); //读取客观数据,若成功则返回更新后的数据,若失败则返回null var stationDataList1 = ChartProcess.NFDataRead(missionInfo, stationDataList); //若更新成功,则保存,并返回新数据,否则返回原数据 if (stationDataList1 != null) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory + "\\DailyData\\Meteorological\\ForecastFiles\\" + DateTime.Today.ToString("yyyyMMdd") + "\\"; string fileName = missionInfo.forecastFilesHead + DateTime.Today.ToString("yyyyMMdd") + ".txt"; if (!ChartProcess.ChartWrite(stationDataList1, baseDirectory + fileName)) { return(null); } return(stationDataList1); } else { return(stationDataList); } }
public List <StationData> NWPRead(MissionInfo missionInfo) { if (missionInfo == null & missionInfo.stationInfoFile == null & missionInfo.forecastFilesHead == null & missionInfo.missionID == 0) { return(null); } //读取站点每日数据 List <StationData> stationDataList = ChartProcess.DailyFileRead(missionInfo); //读取客观数据,若成功则返回更新后的数据,若失败则返回null stationDataList = ChartProcess.NFDataRead(missionInfo, stationDataList); return(stationDataList); }
public bool MeteoDataInput(MeteoDataInputModel meteoDataInputModel) { string stateStr = ""; // 初始化当天的表格,当天没有文件就新建一个 if (!ChartProcess.ChartPreparation(meteoDataInputModel.missionInfo)) { return(false); } //读取当天的文件 List <StationData> stationList = ChartProcess.DailyFileRead(meteoDataInputModel.missionInfo); if (stationList == null) { return(false); } //寻找相同id的修改预报值 try { stationList.ForEach(s => { s.visibility = s.stationID == meteoDataInputModel.stationID ? meteoDataInputModel.visibility : s.visibility; }); string baseDirectory = AppDomain.CurrentDomain.BaseDirectory + "\\DailyData\\Meteorological\\ForecastFiles\\" + DateTime.Today.ToString("yyyyMMdd") + "\\"; string fileName = meteoDataInputModel.missionInfo.forecastFilesHead + DateTime.Today.ToString("yyyyMMdd") + ".txt"; stateStr = fileName; if (!ChartProcess.ChartWrite(stationList, baseDirectory + fileName)) { return(false); } } catch (Exception e) { CommonTools.WriteLog("更新气象预报信息异常:" + stateStr + "\r\n" + e.Message); return(false); } return(true); }