public Atmosphere(EarthModel earth, bool loadFromStateFiles, float defaultValue = 0) { this.Earth = earth; SeaLevel = new SeaLevel(earth, loadFromStateFiles, defaultValue); MidLevel = new MidLevel(earth, loadFromStateFiles, defaultValue); TopLevel = new TopLevel(earth, loadFromStateFiles, defaultValue); JetLevel = new JetLevel(earth, loadFromStateFiles, defaultValue); if (loadFromStateFiles == false) { if (defaultValue == 0) { TopLevel.LoadInitialConditions(); MidLevel.LoadInitialConditions(); CalculateAirMassType(); SeaLevel.LoadInitialConditions(); } else { AirMass = MatrixFactory.Init(defaultValue); } } else { AirMass = FileSupport.Load(Earth.UTC.Title, "M_00_MAP"); } }
public AtmosphericLevel(EarthModel earth, int levelType, bool loadFromStateFiles, float defaultValue = 0) { this.Earth = earth; _levelType = levelType; if (loadFromStateFiles) { P = FileSupport.Load(Earth.UTC.Title, string.Format("P_{0:d2}_MAP", _levelType)); T = FileSupport.Load(Earth.UTC.Title, string.Format("T_{0:d2}_MAP", _levelType)); H = FileSupport.Load(Earth.UTC.Title, string.Format("H_{0:d2}_MAP", _levelType)); } else if (defaultValue != 0) { P = MatrixFactory.Init(defaultValue); T = MatrixFactory.Init(defaultValue); H = MatrixFactory.Init(defaultValue); } }
public SurfaceLevel(EarthModel earth, bool loadFromStateFiles, float defaultValue = 0) { this.Earth = earth; InitGeographicalParams(); if (loadFromStateFiles == false) { if (defaultValue == 0) { // ------------ // Soil temperature where applicable string filePath = Path.Combine(SimulationData.WorkFolder, "SOIL.thd"); if (File.Exists(filePath)) { var tl = FileSupport.LoadMatrixFromFile(filePath); TL.Assign((r, c) => { if (WL[r, c] == 0) { return(tl[r, c]); } return(0); }); } // ------------ // Sea temperature where applicable filePath = Path.Combine(SimulationData.WorkFolder, "SST.thd"); if (File.Exists(filePath)) { var tw = FileSupport.LoadMatrixFromFile(filePath); TW.Assign((r, c) => { if (WL[r, c] != 0) { return(tw[r, c]); } return(0); }); } // Combined surface temperature TS.Assign((r, c) => { if (WL[r, c] != 0) { return(TW[r, c]); } return(TL[r, c]); }); // ------------ // Snow cover filePath = Path.Combine(SimulationData.WorkFolder, "SNOW.thd"); if (File.Exists(filePath)) { this.SNOW = FileSupport.LoadMatrixFromFile(filePath); } } else { TE = MatrixFactory.Init(defaultValue); TW = MatrixFactory.Init(defaultValue); TL = MatrixFactory.Init(defaultValue); TS = MatrixFactory.Init(defaultValue); SNOW = MatrixFactory.Init(defaultValue); RAIN = MatrixFactory.Init(defaultValue); BLIZZARD = MatrixFactory.Init(defaultValue); ALBEDO = MatrixFactory.Init(defaultValue); Precip = MatrixFactory.Init(defaultValue); TLow = MatrixFactory.Init(defaultValue); THigh = MatrixFactory.Init(defaultValue); LIDX = MatrixFactory.Init(defaultValue); FOG = MatrixFactory.Init(defaultValue); TNormLow = MatrixFactory.Init(defaultValue); TNormHigh = MatrixFactory.Init(defaultValue); } } else { TE = FileSupport.Load(Earth.UTC.Title, "T_TE_MAP"); TW = FileSupport.Load(Earth.UTC.Title, "T_TW_MAP"); TL = FileSupport.Load(Earth.UTC.Title, "T_TL_MAP"); TS = FileSupport.Load(Earth.UTC.Title, "T_TS_MAP"); SNOW = FileSupport.Load(Earth.UTC.Title, "N_00_MAP"); RAIN = FileSupport.Load(Earth.UTC.Title, "R_00_MAP"); BLIZZARD = FileSupport.Load(Earth.UTC.Title, "B_00_MAP"); ALBEDO = FileSupport.Load(Earth.UTC.Title, "A_00_MAP"); Precip = FileSupport.Load(Earth.UTC.Title, "C_00_MAP"); TLow = FileSupport.Load(Earth.UTC.Title, "T_SL_MAP"); THigh = FileSupport.Load(Earth.UTC.Title, "T_SH_MAP"); LIDX = FileSupport.Load(Earth.UTC.Title, "L_00_MAP"); FOG = FileSupport.Load(Earth.UTC.Title, "F_SI_MAP"); TNormLow = FileSupport.Load(Earth.UTC.Title, "T_NL_MAP"); TNormHigh = FileSupport.Load(Earth.UTC.Title, "T_NH_MAP"); } }