diff --git a/definitions/grib2/section.3.def b/definitions/grib2/section.3.def index ad06e8a1f..d8ce26e6f 100644 --- a/definitions/grib2/section.3.def +++ b/definitions/grib2/section.3.def @@ -110,6 +110,7 @@ concept gridType { "lambert_bf" = { gridDefinitionTemplateNumber=63; PLPresent=0; } "mercator_bf" = { gridDefinitionTemplateNumber=61; PLPresent=0; } "polar_stereographic_bf" = { gridDefinitionTemplateNumber=62; PLPresent=0; } + "healpix" = { gridDefinitionTemplateNumber=150; PLPresent=0; } "ncep_32769" = { centre=7; gridDefinitionTemplateNumber=32769; PLPresent=0; } diff --git a/definitions/grib2/template.3.150.def b/definitions/grib2/template.3.150.def new file mode 100644 index 000000000..ea9f76811 --- /dev/null +++ b/definitions/grib2/template.3.150.def @@ -0,0 +1,7 @@ +# TEMPLATE 3.150 - The HEALPix grid +# See https://healpix.jpl.nasa.gov/pdf/intro.pdf + +include "grib2/template.3.shape_of_the_earth.def"; +include "grib2/template.3.resolution_flags.def"; +include "grib2/template.3.healpix.def"; + diff --git a/definitions/grib2/template.3.healpix.def b/definitions/grib2/template.3.healpix.def new file mode 100644 index 000000000..0975a039b --- /dev/null +++ b/definitions/grib2/template.3.healpix.def @@ -0,0 +1,47 @@ +# (C) Copyright 2005- ECMWF. + +# See https://healpix.jpl.nasa.gov/pdf/intro.pdf + +constant isGridded = one; + +# Number of grid points along one side of one of the 12 base resolution pixels (>=1) +# The number of data points should be = 12 * Nside * Nside +unsigned[4] Nside : edition_specific,dump; +alias N = Nside; +alias numberOfPointsAlongASide = Nside; +alias geography.Nside = Nside; + +# Longitude of the centre line of the first rhomboid +unsigned[4] longitudeOfFirstGridPoint : edition_specific,dump; +alias Lo = longitudeOfFirstGridPoint; +alias geography.longitudeOfFirstGridPoint = longitudeOfFirstGridPoint; + +# Position of the points. Default = Grid points at centres of shape +codetable[1] gridPointPosition ('3.8.table',masterDir,localDir) = 4 : edition_specific,dump; +alias geography.gridPointPosition = gridPointPosition; + +# Ordering convention of points. Default = ring +codetable[1] ordering ('3.12.table',masterDir,localDir) = 0 : edition_specific,dump; +concept orderingConvention(unknown) { + "ring" = { ordering = 0; } + "nested" = { ordering = 1; } +} : dump; +alias geography.pointsOrdering = orderingConvention; + +flags[1] scanningMode 'grib2/tables/[tablesVersion]/3.13.table'; +flagbit iScansNegatively(scanningMode,7) : dump; # WMO bit 1 +flagbit jScansPositively(scanningMode,6) : dump; # WMO bit 2 +transient iScansPositively = !iScansNegatively : constraint; +transient jScansNegatively = !jScansPositively : constraint; + +iterator healpix(numberOfPoints,missingValue,values,Nside,orderingConvention); +nearest healpix(values,radius,Nx,Ny); + +meta latLonValues latlonvalues(values); +alias latitudeLongitudeValues=latLonValues; +meta latitudes latitudes(values,0); +meta longitudes longitudes(values,0); +meta distinctLatitudes latitudes(values,1); +meta distinctLongitudes longitudes(values,1); + +meta gridName sprintf("H%d", N) : no_copy;