@@ -269,182 +269,3 @@ def _build_sources(self) -> dict:
269269 }
270270
271271
272- # ---------------------------------------------------------------------------
273- # NAVGEM (recent — NOMADS)
274- # ---------------------------------------------------------------------------
275-
276-
277- class NavgemNOMADS (HerbieModel ):
278- """
279- Navy Global Environment Model (NAVGEM) — recent data from NOMADS.
280-
281- Approximately last two days available.
282-
283- Parameters
284- ----------
285- date : str or datetime
286- Model initialization datetime (UTC).
287- step : int, default 0
288- Forecast lead time in hours (0–168).
289-
290- References
291- ----------
292- * https://www.nrlmry.navy.mil/metoc/nogaps/navgem.html
293- """
294-
295- MODEL_NAME = "NavgemNOMADS"
296- MODEL_DESCRIPTION = "Navy Global Environment Model — NOMADS (recent)"
297- MODEL_WEBSITES = {
298- "NOMADS" : "https://nomads.ncep.noaa.gov/pub/data/nccf/com/fnmoc/prod/" ,
299- }
300-
301- PARAMS = {}
302-
303- def _build_sources (self ) -> dict :
304- d = self .date
305- step = self .step
306- path = f"navgem.{ d :%Y%m%d} /navgem_{ d :%Y%m%d%H} f{ step :03d} .grib2"
307- return {
308- "nomads" : GribSource (
309- f"https://nomads.ncep.noaa.gov/pub/data/nccf/com/fnmoc/prod/{ path } " ,
310- [".idx" ],
311- ),
312- }
313-
314-
315- # ---------------------------------------------------------------------------
316- # NAVGEM / NOGAPS historical — GODAE server
317- # ---------------------------------------------------------------------------
318-
319-
320- class NavgemGODAE (HerbieModel ):
321- """
322- NAVGEM (2013–2024) and NOGAPS (2004–2013) historical archive on GODAE.
323-
324- Uses GRIB1 for NOGAPS and GRIB2 for NAVGEM. Variable selection uses
325- wgrib2-style shorthand that is mapped to GODAE filename components.
326-
327- Parameters
328- ----------
329- date : str or datetime
330- Model initialization datetime (UTC).
331- step : int, default 0
332- Forecast lead time in hours.
333- variable : str
334- Field to retrieve, in wgrib2-style format: ``'VARNAME:LEVEL'``.
335- Examples: ``'TMP:500 mb'``, ``'UGRD:10 m'``, ``'HGT:surface'``.
336- product : {'GMET', 'GLND', 'GOCN'}, default 'GMET'
337- Product category.
338-
339- References
340- ----------
341- * https://usgodae.org/
342- * https://usgodae.org/docs/layout/mdllayout.pns.html
343- """
344-
345- MODEL_NAME = "NavgemGODAE"
346- MODEL_DESCRIPTION = "NAVGEM / NOGAPS Historical — GODAE Archive"
347- MODEL_WEBSITES = {
348- "GODAE" : "https://usgodae.org/" ,
349- "Filename guide" : "https://usgodae.org/docs/layout/mdllayout.pns.html" ,
350- }
351-
352- PARAMS = {
353- "product" : {
354- "default" : "GMET" ,
355- "valid" : ["GMET" , "GLND" , "GOCN" , "GCOM" ],
356- "descriptions" : {
357- "GMET" : "Meteorological fields" ,
358- "GLND" : "Land / terrain fields" ,
359- "GOCN" : "Ocean fields" ,
360- "GCOM" : "Composition fields" ,
361- },
362- },
363- "variable" : {
364- "default" : "TMP:500 mb" ,
365- },
366- }
367-
368- # wgrib2 variable name → GODAE filename variable component
369- _VAR_MAP = {
370- "TMP" : "air_temp" ,
371- "DEPR" : "dwpt_dprs" ,
372- "ABSV" : "abs_vort" ,
373- "RH" : "rltv_hum" ,
374- "PRES" : "pres" ,
375- "UGRD" : "wnd_ucmp" ,
376- "VGRD" : "wnd_vcmp" ,
377- "HGT" : "geop_ht" ,
378- "VAPP" : "vpr_pres" ,
379- "VVEL" : "wnd_vert_vel" ,
380- "CAPE" : "cape" ,
381- "VIS" : "visib" ,
382- "PWAT" : "prcp_h20" ,
383- "PRATE" : "rain_rate" ,
384- "SHTFL" : "snsb_heat_flux" ,
385- "SNOD" : "snw_dpth" ,
386- "NSWRS" : "sol_rad" ,
387- "UFLX" : "wnd_strs_ucmp" ,
388- "VFLX" : "wnd_strs_vcmp" ,
389- "PRMSL" : "pres_msl" ,
390- }
391-
392- def _parse_variable (self ) -> tuple [str , str ]:
393- """Return (godae_variable, godae_level) from the wgrib2-style variable string."""
394- raw = self .params .get ("variable" , "TMP:500 mb" )
395- if ":" in raw :
396- var , lev = raw .split (":" , 1 )
397- else :
398- var , lev = raw , "surface"
399-
400- godae_var = self ._VAR_MAP .get (var .upper (), var .lower ())
401-
402- if var .upper () == "HGT" and lev == "surface" :
403- return "terr_ht" , "0001_000000-000000"
404-
405- if var .upper () in {"MSLMA" , "PRMSL" }:
406- return godae_var , "0102_000000-000000"
407-
408- lev = lev .strip ()
409- if lev .endswith ("mb" ):
410- mb = int (lev .replace ("mb" , "" ).strip ())
411- return godae_var , f"0100_{ mb :06d} -000000"
412- if lev == "2 m" :
413- return godae_var , "0105_000020-000000"
414- if lev == "10 m" :
415- return godae_var , "0105_000100-000000"
416- if lev in {"surface" , "sfc" }:
417- return godae_var , "0001_000000-000000"
418- if lev == "tropopause" :
419- return godae_var , "0007_000000-000000"
420-
421- return godae_var , "0001_000000-000000"
422-
423- def _build_sources (self ) -> dict :
424- d = self .date
425- step = self .step
426- product = self .params ["product" ]
427- godae_var , godae_level = self ._parse_variable ()
428-
429- navgem_url = (
430- f"https://usgodae.org/ftp/outgoing/fnmoc/models/navgem_0.5/"
431- f"{ d :%Y/%Y%m%d%H} /"
432- f"US058{ product } -GR1mdl.0018_0056_{ step :03d} 00F0RL"
433- f"{ d :%Y%m%d%H} _{ godae_level } { godae_var } "
434- )
435- navgem_gr2 = (
436- navgem_url .replace ("GR1mdl" , "GR2mdl" ).replace ("0018_0056" , "0018_0056" )
437- + ".gr2"
438- )
439- nogaps_url = (
440- f"https://usgodae.org/ftp/outgoing/fnmoc/models/nogaps/"
441- f"{ d :%Y/%Y%m%d%H} /"
442- f"US058{ product } -GR1mdl.0058_0240_{ step :03d} 00F0RL"
443- f"{ d :%Y%m%d%H} _{ godae_level } { godae_var } "
444- )
445-
446- return {
447- "navgem" : GribSource (navgem_url , [".idx" ]),
448- "navgem_grib2" : GribSource (navgem_gr2 , [".idx" ]),
449- "nogaps" : GribSource (nogaps_url , [".idx" ]),
450- }
0 commit comments