File tree Expand file tree Collapse file tree 2 files changed +44
-4
lines changed
Expand file tree Collapse file tree 2 files changed +44
-4
lines changed Original file line number Diff line number Diff line change 33 * @module
44 */
55import type { Config , MixedLayerConfig , WindConfig } from "./config.js" ;
6+ import { qsatLiq } from "./thermodynamics.js" ;
67import { findInsertIndex , interpolateHourly } from "./utils.js" ;
78
89// Constants
@@ -209,6 +210,26 @@ export class CLASS {
209210 return this . wtheta + 0.61 * this . ml . theta * this . wq ;
210211 }
211212
213+ /** RH at surface */
214+ get RH ( ) : number {
215+ this . assertMixedLayer ( ) ;
216+ /** this is compatible with the inaccurate original CLASS method with rho = 1.2 */
217+ const qsat_h = qsatLiq ( this . _cfg . p0 , this . ml . theta ) ;
218+ return ( 100.0 * this . ml . qt ) / qsat_h ;
219+ }
220+ /** RH at h */
221+ get RH_h ( ) : number {
222+ this . assertMixedLayer ( ) ;
223+ /** this is compatible with the inaccurate original CLASS method with rho = 1.2 */
224+ const rho = 1.2 ;
225+ const g = 9.81 ;
226+ const cp = 1005.0 ;
227+ const p_h = this . _cfg . p0 - this . ml . h * rho * g ;
228+ const T_h = this . ml . theta - ( g / cp ) * this . ml . h ;
229+ const qsat_h = qsatLiq ( p_h , T_h ) ;
230+ return ( 100.0 * this . ml . qt ) / qsat_h ;
231+ }
232+
212233 // Lapse rates
213234
214235 /** Free atmosphere potential temperature lapse rate */
@@ -270,6 +291,10 @@ export class CLASS {
270291 return this . ml ?. qt || 999 ;
271292 }
272293
294+ get time_hour ( ) {
295+ return this . t / 3600.0 ;
296+ }
297+
273298 get utcTime ( ) {
274299 // export time in milliseconds since epoch so bounds calculation and
275300 // rendering can happen on app side
Original file line number Diff line number Diff line change @@ -8,12 +8,17 @@ export const outputVariables = {
88 t : {
99 title : "Time" ,
1010 unit : "s" ,
11- symbol : "t" ,
11+ symbol : "time (s)" ,
12+ } ,
13+ time_hour : {
14+ title : "Time" ,
15+ unit : "h" ,
16+ symbol : "time (h)" ,
1217 } ,
1318 utcTime : {
14- title : "Time ( UTC) " ,
15- unit : "- " ,
16- symbol : "UTC" ,
19+ title : "Time UTC" ,
20+ unit : "h " ,
21+ symbol : "time (h UTC) " ,
1722 } ,
1823 h : {
1924 title : "ABL height" ,
@@ -95,6 +100,16 @@ export const outputVariables = {
95100 unit : "m s⁻¹" ,
96101 symbol : "Δv" ,
97102 } ,
103+ RH : {
104+ title : "Relative humidity at the surface" ,
105+ unit : "%" ,
106+ symbol : "RH" ,
107+ } ,
108+ RH_h : {
109+ title : "Relative humidity at h" ,
110+ unit : "%" ,
111+ symbol : "RH_h" ,
112+ } ,
98113} as const satisfies Record < string , VariableInfo > ;
99114
100115export type OutputVariableKey = keyof typeof outputVariables ;
You can’t perform that action at this time.
0 commit comments