Skip to content

Commit

Permalink
adding era5_nancy files
Browse files Browse the repository at this point in the history
  • Loading branch information
heikoklein committed Sep 18, 2024
1 parent 28d605a commit 11b540b
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 3 deletions.
11 changes: 10 additions & 1 deletion utils/SnapPy/Snappy/Resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MetModel(enum.Enum):
EC0p1Global = "ec_0p1_global"
EC0p1Europe = "ec_0p1_europe"
GfsGribFilter = "gfs_grib_filter_fimex"

Era5Nancy = "era5_nancy"
def __eq__(self, other):
return self.value == str(other)

Expand Down Expand Up @@ -87,12 +87,15 @@ class Resources(ResourcesCommon):
MetModel.GfsGribFilter: [
"{LUSTREDIR}/project/fou/kl/snap/meteo/gfs_europe/"
],
MetModel.Era5Nancy: ["{LUSTREDIR}/project/fou/kl/cerad//Meteorology/EC/Era5/Nancy/"],

}
MET_FILENAME_PATTERN = {
MetModel.Meps2p5: "{year:04d}/{month:02d}/{day:02d}/meps_det_2_5km_{year:04d}{month:02d}{day:02d}T{UTC:02d}Z.nc",
MetModel.Icon0p25Global: "icon_{year:04d}{month:02d}{day:02d}T{UTC:02d}Z.nc",
MetModel.GfsGribFilter: "gfs_0p25deg_{year:04d}{month:02d}{day:02d}T{UTC:02d}Z.nc",
MetModel.EC0p1Europe: "ec_atmo_0_1deg_{year:04d}{month:02d}{day:02d}T{UTC:02d}0000Z_3h.nc",
MetModel.Era5Nancy: "nancy_{year:04d}-{month:02d}-{day:02d}_{UTC:02d}.nc",
}

def __init__(self):
Expand Down Expand Up @@ -154,6 +157,8 @@ def getDefaultMetDefinitions(self, metmodel):
return {}
elif metmodel == MetModel.GfsGribFilter:
return {}
elif metmodel == MetModel.Era5Nancy:
return {}

raise (NotImplementedError("metmodel='{}' not implememented".format(metmodel)))

Expand Down Expand Up @@ -430,6 +435,8 @@ def _getSnapInputTemplate(self, metmodel=None):
filename = os.path.join(self.directory, "snap.input_icon_0p25.tmpl")
elif metmodel == MetModel.GfsGribFilter:
filename = os.path.join(self.directory, "snap.input_gfs_grib_filter.tmpl")
elif metmodel == MetModel.Era5Nancy:
filename = os.path.join(self.directory, "snap.input_era5_nancy.tmpl")
else:
raise (
NotImplementedError("metmodel='{}' not implememented".format(metmodel))
Expand Down Expand Up @@ -466,6 +473,8 @@ def getSnapInputMetDefinitions(
elif metmodel == MetModel.GfsGribFilter:
# no setup needed, autdetection in snap
pass
elif metmodel == MetModel.Era5Nancy:
pass
else:
raise (
NotImplementedError("metmodel='{}' not implememented".format(metmodel))
Expand Down
1 change: 0 additions & 1 deletion utils/SnapPy/Snappy/resources/snap.input_ec_0p1.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ MAX.TOTALPARTICLES= 20000000
TIME.STEP= 600.
STEP.HOUR.INPUT.MIN= 3
STEP.HOUR.INPUT.MAX= 6
STEP.HOUR.OUTPUT.FIELDS= 3
ASYNOPTIC.OUTPUT
TOTAL.COMPONENTS.OFF
MSLP.OFF
Expand Down
53 changes: 53 additions & 0 deletions utils/SnapPy/Snappy/resources/snap.input_era5_nancy.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
***********************************************************************
*** MET Norway SNAP input file derived from snap.input_era5_nancy.tmpl
***********************************************************************
RANDOM.WALK.ON
BOUNDARY.LAYER.FULL.MIX.OFF
DRY.DEPOSITION.NEW
WET.DEPOSITION.VERSION = 2

REMOVE.RELATIVE.MASS.LIMIT= 0.

MAX.TOTALPARTICLES= 20000000
TIME.STEP= 300.
STEP.HOUR.INPUT.MIN= 1
STEP.HOUR.INPUT.MAX= 6
ASYNOPTIC.OUTPUT
TOTAL.COMPONENTS.OFF
MSLP.OFF
PRECIPITATION.ON
MODEL.LEVEL.FIELDS.OFF
POSITIONS.DECIMAL


FIELD.TYPE=fimex
FIMEX.FILE_TYPE= netcdf
FIMEX.CONFIG=
{interpolation}

GRID.AUTODETECT.FROM_INPUT
* ec_det in newer versions of snap
GRID.NCTYPE = era5
DATA.ETA.LEVELS
ENSEMBLE_MEMBER.INPUT = 0

FIELD_TIME.FORECAST

** OUTPUT FILES
FIELD.OUTTYPE=netcdf
FIELD.OUTPUT= snap.nc


OUTPUT.COLUMN.ON
* OUTPUT.AIRCRAFT_DOSERATE.ENABLE
* Tiltaksgrense Avsperring
* Se Sivilforsvaret Bestemmelser om sikkerhet under opplæring, øving og
* innsats i Sivilforsvaret
* Grense i Sv/h
OUTPUT.AIRCRAFT_DOSERATE.THRESHOLD.SV_H = 60e-6


LOG.FILE= snap.log
DEBUG.ON


6 changes: 5 additions & 1 deletion utils/SnapPy/snap4rimsterm
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ STEP.HOUR.OUTPUT.FIELDS= {outputTimestep:d}
files = res.getMeteorologyFiles(met_model, startDTime, runTime, "best")
if (len(files) == 0):
raise Exception("no GFS-grib-filter-fimex met-files found for {}, runtime {}".format(startDTime, runTime))
elif met_model == MetModel.Era5Nancy:
files = res.getMeteorologyFiles(met_model, startDTime, runTime, "best")
if (len(files) == 0):
raise Exception("no era5_nancy met-files found for {}, runtime {}".format(startDTime, runTime))
else:
raise Exception('unknown met_model: {}'.format(met_model))

Expand Down Expand Up @@ -317,7 +321,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description="run snap from a rimsterm.xml file and convert to grib-files named ident_conc, ident_depo ident_wetd ident_dose ident_tofa")
parser.add_argument("--rimsterm", help="source-term in rimsterm format", required=True)
parser.add_argument("--argosrequest", help="optional argos-request xml file in addition to --rimsterm file", required=False)
parser.add_argument("--metmodel", help="select the NWP input model, nrpa_ec_0p1, nrpa_ec_0p1_global, meps_2_5km, ec_0p1_global, ec_0p1_europe, gfs_grib_filter_fimex, icon_0p25_global", required=True, default='nrpa_ec_0p1')
parser.add_argument("--metmodel", help="select the NWP input model, nrpa_ec_0p1, nrpa_ec_0p1_global, meps_2_5km, ec_0p1_global, ec_0p1_europe, gfs_grib_filter_fimex, icon_0p25_global, era5_nancy", required=True, default='nrpa_ec_0p1')
parser.add_argument("--dir", help="output-directory", required=True)
parser.add_argument("--ident", help="output-file identifier", required=True)
parser.add_argument("--bitmapCompress", help="enable grib bitmap-compression", action='store_true')
Expand Down

0 comments on commit 11b540b

Please sign in to comment.