//Interpolate data in space-time and return all 3D climatogical variables public wx_atm getAmbientWx3D(double vheight) { double epoch_time = Util.getLocalTime_Wx(); //Get local time (i.e. UT time) Dictionary <string, int> idx = get_dim_idx(vheight); //Get index of coordinates closest to vessel location int t = idx["t"]; int z = idx["z"]; double uu; double vv; double ww; double tt; double pp; double rh; double vis; double cldfrac; ww = bilinear_interp(0, t, z, epoch_time, vheight); //Retrieve vertical wind component uu = bilinear_interp(1, t, z, epoch_time, vheight); //Retrieve zonal wind component vv = bilinear_interp(2, t, z, epoch_time, vheight); //Retrieve meridional wind component tt = bilinear_interp(3, t, z, epoch_time, vheight); //Retrieve ambient temperature pp = bilinear_interp(4, t, z, epoch_time, vheight); //Retrieve ambient pressure rh = bilinear_interp(5, t, z, epoch_time, vheight); //Retrieve relative humidity vis = bilinear_interp(6, t, z, epoch_time, vheight); //Retrieve visibility cldfrac = bilinear_interp(7, t, z, epoch_time, vheight); //Retrieve cloud fraction //Perform validity checks /*if (cldfrac < 0) * { * cldfrac = 0.0; * }*/ if (vis < 0) { vis = 0.0; } if (rh < 0) { rh = 0.0; } else if (rh > 100) { rh = 100.0; } //Compute air density double rho = (pp / (Util.Rd * tt)); //Util.Log("Pressure: " + pp + ", zidx: " + z); //Return all fields as struct wx_atm wx_data = new wx_atm(); wx_data.wind_x = uu; wx_data.wind_y = vv; wx_data.wind_z = ww; wx_data.temperature = tt; wx_data.pressure = pp; wx_data.density = rho; wx_data.humidity = rh; wx_data.visibility = vis; wx_data.cloudcover = cldfrac; return(wx_data); }
//Interpolate data in space-time and return all 3D climatogical variables public wx_atm getAmbientWx3D(double vlat, double vlng, double vheight) { double epoch_time = Util.getLocalTime(); //Get local time (i.e. UT time) Dictionary <string, int> idx = get_dim_idx(vlat, vlng, vheight); //Get index of coordinates closest to vessel location int t = idx["t"]; int z = idx["z"]; int x = idx["x"]; int y = idx["y"]; double uu; double vv; double ww; double tt; double pp; double rh; double vis; double cldfrac; ww = interp_var3d(0, t, z, y, x, epoch_time, vheight, vlat, vlng); //Retrieve vertical wind component uu = interp_var3d(1, t, z, y, x, epoch_time, vheight, vlat, vlng); //Retrieve zonal wind component vv = interp_var3d(2, t, z, y, x, epoch_time, vheight, vlat, vlng); //Retrieve meridional wind component tt = interp_var3d(3, t, z, y, x, epoch_time, vheight, vlat, vlng); //Retrieve ambient temperature pp = interp_var3d(4, t, z, y, x, epoch_time, vheight, vlat, vlng); //Retrieve ambient pressure rh = interp_var3d(5, t, z, y, x, epoch_time, vheight, vlat, vlng); //Retrieve relative humidity vis = interp_var3d(6, t, z, y, x, epoch_time, vheight, vlat, vlng); //Retrieve visibility cldfrac = interp_var3d(7, t, z, y, x, epoch_time, vheight, vlat, vlng); //Retrieve cloud fraction //Compute air density double rho = (pp / (Util.Rd * tt)); //Perform validity checks if (vis < 0) { vis = 0.0; } if (rh < 0) { rh = 0.0; } else if (rh > 100) { rh = 100.0; } //Return all fields as struct wx_atm wx_data = new wx_atm(); wx_data.wind_x = uu; wx_data.wind_y = vv; wx_data.wind_z = ww; wx_data.temperature = tt; wx_data.pressure = pp; wx_data.density = rho; wx_data.humidity = rh; wx_data.visibility = vis; wx_data.cloudcover = cldfrac; return(wx_data); }