diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/Makefile.am b/modules/dmrpp_module/get_dmrpp/unit-tests/Makefile.am index faf6888599..a9dc33b67d 100644 --- a/modules/dmrpp_module/get_dmrpp/unit-tests/Makefile.am +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/Makefile.am @@ -32,7 +32,9 @@ echo-variables: # allow writing to the source directory. # # I do not understand why the module *.so files are copied. jhrg 8/31/25 -# +# Answer for the above comments: +# The generation of dmr with besstandalone needs to have these modules at this location. +# KY 2026-06-08 cp_build_script: if test $(srcdir) != .; then \ cp -f `echo $(srcdir) | rev | cut -c 11- | rev`/gen_dmrpp_side_car $(builddir); \ @@ -46,6 +48,7 @@ cp_build_script: cp -f $(abs_top_builddir)/modules/hdf5_handler/.libs/libhdf5_module.so $(builddir); \ cp -f $(abs_top_builddir)/modules/hdf4_handler/.libs/libhdf4_module.so $(builddir); \ cp -f $(abs_top_builddir)/modules/fileout_netcdf/.libs/libfonc_module.so $(builddir); \ + cp -f $(abs_top_builddir)/modules/dmrpp_module/.libs/libdmrpp_module.so $(builddir); \ cp -f $(abs_top_builddir)/xmlcommand/.libs/libdap_xml_module.so $(builddir); \ cp -f $(abs_top_builddir)/dap/.libs/libdap_module.so $(builddir); \ else \ @@ -56,6 +59,7 @@ cp_build_script: cp -f $(abs_top_builddir)/modules/hdf5_handler/.libs/libhdf5_module.so $(builddir); \ cp -f $(abs_top_builddir)/modules/hdf4_handler/.libs/libhdf4_module.so $(builddir); \ cp -f $(abs_top_builddir)/modules/fileout_netcdf/.libs/libfonc_module.so $(builddir); \ + cp -f $(abs_top_builddir)/modules/dmrpp_module/.libs/libdmrpp_module.so $(builddir); \ cp -f $(abs_top_builddir)/xmlcommand/.libs/libdap_xml_module.so $(builddir); \ cp -f $(abs_top_builddir)/dap/.libs/libdap_module.so $(builddir); \ fi; @@ -76,6 +80,7 @@ clean-local: rm -f $(builddir)/libhdf5_module.so; \ rm -f $(builddir)/libhdf4_module.so; \ rm -f $(builddir)/libfonc_module.so; \ + rm -f $(builddir)/libdmrpp_module.so; \ rm -f $(builddir)/libdap_xml_module.so; \ rm -f $(builddir)/libdap_module.so; \ rm -rf $(builddir)/__pycache__; \ @@ -84,4 +89,5 @@ clean-local: rm -f $(builddir)/$(HDF5_FILES); \ rm -f $(builddir)/$(PYTHON_FILES); \ rm -f $(builddir)/$(BASELINE_FILES); \ + rm -f $(builddir)/bes.log; \ fi; diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/gen_bescmd_conf.py b/modules/dmrpp_module/get_dmrpp/unit-tests/gen_bescmd_conf.py new file mode 100644 index 0000000000..081ac26529 --- /dev/null +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/gen_bescmd_conf.py @@ -0,0 +1,75 @@ +# This script that generates the bes configuration and xml files for testing the gen_dmrpp_side_car. +# The functions defined in this script are used by the gen_dmrpp_side_car_test.py. +import os +import shutil +import string +import subprocess +import sys + +# The function add_module_path() adds the module path +def add_module_path(f_str, conf_mod_name, mod_path): + index = f_str.find(conf_mod_name) + len(conf_mod_name) + if (f_str[index] != '\n'): + print(conf_mod_name) + print(f_str[index]) + print("The module path should be empty.") + sys.exit(1) + temp_text = f_str[:index] + mod_path + f_str[index:] + return temp_text + +# Generate the BES configuration file +def generate_bes_conf(): + bes_conf_name="bes.test.conf" + bes_conf_str=r'''BES.LogName=./bes.log +BES.modules=dap,cmd,fonc,dmrpp +BES.module.dap= +BES.module.cmd= +BES.module.dmrpp= +BES.module.fonc= +BES.Catalog.catalog.RootDirectory= +BES.Data.RootDirectory=/dev/null +BES.Catalog.catalog.TypeMatch+=dmrpp:.*\.(dmrpp)$; +BES.Catalog.catalog.Include=; +BES.Catalog.catalog.Exclude=^\..*; +BES.FollowSymLinks=Yes +BES.Catalog.catalog.FollowSymLinks=Yes +BES.UncompressCache.dir=/tmp +BES.UncompressCache.prefix=uncompress_cache +BES.UncompressCache.size=500 +FONc.UseCompression=true +FONc.ChunkSize=4096 +FONc.ClassicModel=false +FONc.NoGlobalAttrs=true +AllowedHosts+=^https?:\/\/''' + cur_dir_bs = os.getcwd() +'/' + bes_conf_str=add_module_path(bes_conf_str,"BES.module.dap=",cur_dir_bs+'libdap_module.so') + bes_conf_str=add_module_path(bes_conf_str,"BES.module.cmd=",cur_dir_bs+'libdap_xml_module.so') + bes_conf_str=add_module_path(bes_conf_str,"BES.module.dmrpp=",cur_dir_bs+'libdmrpp_module.so') + bes_conf_str=add_module_path(bes_conf_str,"BES.module.fonc=",cur_dir_bs+'libfonc_module.so') + bes_conf_str=add_module_path(bes_conf_str,"BES.Catalog.catalog.RootDirectory=",os.getcwd()) + bc_fid=open(bes_conf_name, 'w') + bc_fid.write(bes_conf_str) + bc_fid.close() + +# Generate the xml file that tells the BES to return the netCDF-4 file. +def generate_bes_cmd(dmrpp_name): + bescmd_str_p1 = ''' + + dap4 + ''' + bescmd_str_p1 = bescmd_str_p1 + dmrpp_name + "" + bescmd_str_p2 = ''' + + ''' + bescmd_str_p3 = ''' + + +''' + bescmd_str=bescmd_str_p1+bescmd_str_p2+bescmd_str_p3 + bescmd_name=dmrpp_name+"_test.bescmd" + bc_fid=open(bescmd_name, 'w') + bc_fid.write(bescmd_str) + bc_fid.close() + return bescmd_name + + diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/gen_dmrpp_side_car_test.py b/modules/dmrpp_module/get_dmrpp/unit-tests/gen_dmrpp_side_car_test.py index 2da16f6364..c41434d4bb 100644 --- a/modules/dmrpp_module/get_dmrpp/unit-tests/gen_dmrpp_side_car_test.py +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/gen_dmrpp_side_car_test.py @@ -3,6 +3,12 @@ Test gen_dmrpp_side_car script. python3 -m unittest gen_dmrpp_side_car_test +The testing procedure is: +1) Generate the dmrpp file. +2) Generate the netCDF-4 file based on the dmrpp and the original files. +3) Use ncdump to dump the generated netCDF-4 files. +4) Compare the dumped output with the baseline file. +5) clean up the intermeidate testing files. To persist generated assets (e.g. for debugging) set environment variable `PRESERVE_TEST_ASSETS` to any value: PRESERVE_TEST_ASSETS=yes python3 -m unittest gen_dmrpp_side_car_test @@ -11,100 +17,101 @@ import subprocess import filecmp import os +import gen_bescmd_conf class TestSample(unittest.TestCase): + @classmethod + def setUpClass(self): + gen_bescmd_conf.generate_bes_conf() + def test_gen_dmrpp_side_car(self): print("Testing grid_2_2d_ps.hdf") - subprocess.run(["./gen_dmrpp_side_car", "-i", "grid_2_2d_ps.hdf","-H"]) + subprocess.run(["./gen_dmrpp_side_car", "-i", "grid_2_2d_ps.hdf", "-u", "grid_2_2d_ps.hdf", "-H"]) + bescmd_name = gen_bescmd_conf.generate_bes_cmd("grid_2_2d_ps.hdf.dmrpp") + fonc_name=bescmd_name+"_fonc.nc4" + subprocess.run(["besstandalone", "-c", "bes.test.conf", "-i",bescmd_name , "-f", fonc_name]) + + # Here we use ncdump -h since the dmrpp sidecar data involves the floating-point data calculation + # of complex formula. The output data may have a little difference in different platforms. + with open('grid_2_2d_ps.hdf.dmrpp_fonc.nc4.header','w') as nc_header_file: + subprocess.run(["ncdump", "-h", fonc_name],stdout=nc_header_file) + result = filecmp.cmp("grid_2_2d_ps.hdf.dmrpp_fonc.nc4.header","grid_2_2d_ps.hdf.dmrpp_fonc.nc4.header.baseline") + self.assertEqual(result ,True ) if not os.environ.get('PRESERVE_TEST_ASSETS'): self.addCleanup(os.remove, "grid_2_2d_ps.hdf.dmrpp") self.addCleanup(os.remove, "grid_2_2d_ps.hdf_mvs.h5") - - #result = filecmp.cmp("grid_2_2d_ps.hdf.dmrpp","grid_2_2d_ps.hdf.dmrpp.baseline") - #self.assertEqual(result ,True ) - - # Since we also add the dmrpp metadata generation information for the HDF4 files, - # we need to ignore that information when doing comparison. - with open('grid_2_2d_ps.hdf.dmrpp') as f: - dmrpp_lines_after_77 = f.readlines()[77:] - with open('grid_2_2d_ps.hdf.dmrpp.baseline') as f1: - baseline_lines_after_77 = f1.readlines()[77:] - - # Hacky removal of lines that otherwise show spurious failure - # due to test brittleness. (Better fix would be to run same version - # stripping as on non-python tests) - # Although the above statement may be true, - # the following two lines may cause IndexError,however, github macOS build keeps throwing errors. - dmrpp_lines_after_77.pop(221) - baseline_lines_after_77.pop(221) - - self.assertEqual(dmrpp_lines_after_77 ,baseline_lines_after_77) - + self.addCleanup(os.remove, fonc_name) + self.addCleanup(os.remove, bescmd_name) + self.addCleanup(os.remove, "grid_2_2d_ps.hdf.dmrpp_fonc.nc4.header") + def test_gen_dmrpp_side_car2(self): print("Testing grid_2_2d_sin.h5") - subprocess.run(["./gen_dmrpp_side_car", "-i", "grid_2_2d_sin.h5"]) + subprocess.run(["./gen_dmrpp_side_car", "-i", "grid_2_2d_sin.h5", "-u", "grid_2_2d_sin.h5"]) + bescmd_name = gen_bescmd_conf.generate_bes_cmd("grid_2_2d_sin.h5.dmrpp") + fonc_name=bescmd_name+"_fonc.nc4" + subprocess.run(["besstandalone", "-c", "bes.test.conf", "-i",bescmd_name , "-f", fonc_name]) + + # For the use of ncdump -h, see comments of test_gen_dmrpp_side_car(). + with open('grid_2_2d_sin.h5.dmrpp_fonc.nc4.header','w') as nc_header_file: + subprocess.run(["ncdump", "-h", fonc_name],stdout=nc_header_file) + result = filecmp.cmp("grid_2_2d_sin.h5.dmrpp_fonc.nc4.header","grid_2_2d_sin.h5.dmrpp_fonc.nc4.header.baseline") + self.assertEqual(result ,True ) if not os.environ.get('PRESERVE_TEST_ASSETS'): self.addCleanup(os.remove, "grid_2_2d_sin.h5.dmrpp") self.addCleanup(os.remove, "grid_2_2d_sin.h5_mvs.h5") - with open('grid_2_2d_sin.h5.dmrpp') as f: - dmrpp_lines_after_19 = f.readlines()[19:] - with open('grid_2_2d_sin.h5.dmrpp.baseline') as f1: - baseline_lines_after_19 = f1.readlines()[19:] - - # Hacky removal of lines that otherwise show spurious failure - # due to test brittleness. (Better fix would be to run same version - # stripping as on non-python tests) - # The following two lines may cause IndexError and they are not necessary since the testing file should not be changed. - # If the testing file is changed, the right way is to update the baseline file. - #dmrpp_lines_after_19.pop(221) - #baseline_lines_after_19.pop(221) + self.addCleanup(os.remove, fonc_name) + self.addCleanup(os.remove, bescmd_name) + self.addCleanup(os.remove, "grid_2_2d_sin.h5.dmrpp_fonc.nc4.header") - self.assertEqual(dmrpp_lines_after_19 ,baseline_lines_after_19) def test_gen_dmrpp_side_car_h4_nsc(self): print("Testing grid_1_2d.hdf :no side car file") - subprocess.run(["./gen_dmrpp_side_car", "-i", "grid_1_2d.hdf","-H","-D"]) + subprocess.run(["./gen_dmrpp_side_car", "-i", "grid_1_2d.hdf","-H","-D","-u", "grid_1_2d.hdf"]) + bescmd_name = gen_bescmd_conf.generate_bes_cmd("grid_1_2d.hdf.dmrpp") + fonc_name=bescmd_name+"_fonc.nc4" + subprocess.run(["besstandalone", "-c", "bes.test.conf", "-i",bescmd_name , "-f", fonc_name]) + with open('grid_1_2d.hdf.dmrpp_fonc.nc4.data','w') as nc_data_file: + subprocess.run(["ncdump", fonc_name],stdout=nc_data_file) + result = filecmp.cmp("grid_1_2d.hdf.dmrpp_fonc.nc4.data","grid_1_2d.hdf.dmrpp_fonc.nc4.data.baseline") + self.assertEqual(result ,True ) if not os.environ.get('PRESERVE_TEST_ASSETS'): self.addCleanup(os.remove, "grid_1_2d.hdf.dmrpp") - - # Since we also add the dmrpp metadata generation information for the HDF4 files, - # we need to ignore those information when doing comparision. - with open('grid_1_2d.hdf.dmrpp') as f: - dmrpp_lines_after_54 = f.readlines()[54:] - with open('grid_1_2d.hdf.dmrpp.baseline') as f1: - baseline_lines_after_54 = f1.readlines()[54:] - self.assertEqual(dmrpp_lines_after_54 ,baseline_lines_after_54) + self.addCleanup(os.remove, fonc_name) + self.addCleanup(os.remove, bescmd_name) + self.addCleanup(os.remove, "grid_1_2d.hdf.dmrpp_fonc.nc4.data") + def test_gen_dmrpp_side_car_h5_cf(self): print("Testing grid_1_2d.h5 :CF option") - subprocess.run(["./gen_dmrpp_side_car", "-i", "grid_1_2d.h5","-c"]) + subprocess.run(["./gen_dmrpp_side_car", "-i", "grid_1_2d.h5","-c","-u", "grid_1_2d.h5"]) + bescmd_name = gen_bescmd_conf.generate_bes_cmd("grid_1_2d.h5.dmrpp") + fonc_name=bescmd_name+"_fonc.nc4" + subprocess.run(["besstandalone", "-c", "bes.test.conf", "-i",bescmd_name , "-f", fonc_name]) + with open('grid_1_2d.h5.dmrpp_fonc.nc4.data','w') as nc_data_file: + subprocess.run(["ncdump", fonc_name],stdout=nc_data_file) + result = filecmp.cmp("grid_1_2d.h5.dmrpp_fonc.nc4.data","grid_1_2d.h5.dmrpp_fonc.nc4.data.baseline") + self.assertEqual(result ,True ) + if not os.environ.get('PRESERVE_TEST_ASSETS'): self.addCleanup(os.remove, "grid_1_2d.h5.dmrpp") - - - # Since we also add the dmrpp metadata generation informatio for the HDF4 files, - # we need to ignore those information when doing comparision. - # We also ignore the first two lines to skip comparing dmrpp versions - with open('grid_1_2d.h5.dmrpp') as f: - dmrpp_minus_18_lines = f.readlines()[2:-18] - with open('grid_1_2d.h5.dmrpp.baseline') as f1: - baseline_minus_18_lines = f1.readlines()[2:-18] - - # Hacky removal of lines that otherwise show spurious failure - # due to test brittleness. (Better fix would be to run same version - # stripping as on non-python tests) - # Although the above statement may be true, the following lines may cause IndexError.So comment them out. - #dmrpp_minus_18_lines.pop(62) - #baseline_minus_18_lines.pop(62) - - self.assertEqual(dmrpp_minus_18_lines ,baseline_minus_18_lines) - + self.addCleanup(os.remove, "grid_1_2d.h5_mvs.h5") + self.addCleanup(os.remove, fonc_name) + self.addCleanup(os.remove, bescmd_name) + self.addCleanup(os.remove, "grid_1_2d.h5.dmrpp_fonc.nc4.data") + + + @classmethod + def tearDownClass(cls): + if os.path.exists("bes.test.conf"): + os.remove("bes.test.conf") + + if __name__ == '__main__': unittest.main() diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.h5.dmrpp.baseline b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.h5.dmrpp.baseline index 78f8075981..346bf4aafb 100644 --- a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.h5.dmrpp.baseline +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.h5.dmrpp.baseline @@ -1,5 +1,5 @@ - + @@ -70,7 +70,7 @@ - 2026-04-29T17:58:18Z + 2026-06-10T13:31:25Z 3.21.1 @@ -82,7 +82,7 @@ libdap-3.21.1 - build_dmrpp -f /home/rocky/kent/hyrax-2121-test/bes/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.h5 -r grid_1_2d.h5.dmr -u OPeNDAP_DMRpp_DATA_ACCESS_URL -M + /Users/myang6/work/opendap/hyrax-2180/bes/modules/dmrpp_module/.libs/build_dmrpp -f /Users/myang6/work/opendap/hyrax-2180/bes/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.h5 -r grid_1_2d.h5.dmr -u grid_1_2d.h5 -M diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.h5.dmrpp_fonc.nc4.data.baseline b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.h5.dmrpp_fonc.nc4.data.baseline new file mode 100644 index 0000000000..7c6ce848f6 --- /dev/null +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.h5.dmrpp_fonc.nc4.data.baseline @@ -0,0 +1,61 @@ +netcdf grid_1_2d.h5.dmrpp_test.bescmd_fonc { +dimensions: + lon = 8 ; + lat = 4 ; + StructMetadata_0_len = 663 ; +variables: + float lon(lon) ; + lon:units = "degrees_east" ; + float lat(lat) ; + lat:units = "degrees_north" ; + float temperature(lat, lon) ; + temperature:units = "K" ; + temperature:origname = "temperature" ; + temperature:fullnamepath = "/HDFEOS/GRIDS/GeoGrid/Data Fields/temperature" ; + temperature:orig_dimname_list = "YDim XDim" ; + char StructMetadata_0(StructMetadata_0_len) ; + StructMetadata_0:origname = "StructMetadata.0" ; + StructMetadata_0:fullnamepath = "/HDFEOS INFORMATION/StructMetadata.0" ; +data: + + lon = 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5 ; + + lat = 3.5, 2.5, 1.5, 0.5 ; + + temperature = + 10, 10, 10, 10, 10, 10, 10, 10, + 11, 11, 11, 11, 11, 11, 11, 11, + 12, 12, 12, 12, 12, 12, 12, 12, + 13, 13, 13, 13, 13, 13, 13, 13 ; + + StructMetadata_0 = "GROUP=SwathStructure\n", + "END_GROUP=SwathStructure\n", + "GROUP=GridStructure\n", + "\tGROUP=GRID_1\n", + "\t\tGridName=\"GeoGrid\"\n", + "\t\tXDim=8\n", + "\t\tYDim=4\n", + "\t\tUpperLeftPointMtrs=(0.000000,4000000.000000)\n", + "\t\tLowerRightMtrs=(8000000.000000,0.000000)\n", + "\t\tProjection=HE5_GCTP_GEO\n", + "\t\tGROUP=Dimension\n", + "\t\tEND_GROUP=Dimension\n", + "\t\tGROUP=DataField\n", + "\t\t\tOBJECT=DataField_1\n", + "\t\t\t\tDataFieldName=\"temperature\"\n", + "\t\t\t\tDataType=H5T_NATIVE_FLOAT\n", + "\t\t\t\tDimList=(\"YDim\",\"XDim\")\n", + "\t\t\t\tMaxdimList=(\"YDim\",\"XDim\")\n", + "\t\t\tEND_OBJECT=DataField_1\n", + "\t\tEND_GROUP=DataField\n", + "\t\tGROUP=MergedFields\n", + "\t\tEND_GROUP=MergedFields\n", + "\tEND_GROUP=GRID_1\n", + "END_GROUP=GridStructure\n", + "GROUP=PointStructure\n", + "END_GROUP=PointStructure\n", + "GROUP=ZaStructure\n", + "END_GROUP=ZaStructure\n", + "END\n", + "" ; +} diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.hdf.dmrpp.baseline b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.hdf.dmrpp.baseline index 99ed275f87..dfb42799fb 100644 --- a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.hdf.dmrpp.baseline +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.hdf.dmrpp.baseline @@ -1,5 +1,5 @@ - + @@ -37,7 +37,7 @@ END - 2025-10-08T18:16:20Z + 2026-06-10T13:31:24Z 3.21.1 @@ -49,7 +49,7 @@ END libdap-3.21.1 - build_dmrpp_h4 -f /Users/myang6/work/opendap/2025-summer-work/code-cleanup-testing/hyrax-1628/bes/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.hdf -r grid_1_2d.hdf.dmr -u OPeNDAP_DMRpp_DATA_ACCESS_URL -M + build_dmrpp_h4 -f /Users/myang6/work/opendap/hyrax-2180/bes/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.hdf -r grid_1_2d.hdf.dmr -u grid_1_2d.hdf -M H4.EnableCF=false diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.hdf.dmrpp_fonc.nc4.data.baseline b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.hdf.dmrpp_fonc.nc4.data.baseline new file mode 100644 index 0000000000..1f7466bf90 --- /dev/null +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_1_2d.hdf.dmrpp_fonc.nc4.data.baseline @@ -0,0 +1,36 @@ +netcdf grid_1_2d.hdf.dmrpp_test.bescmd_fonc { +dimensions: + YDim_GeoGrid = 4 ; + XDim_GeoGrid = 8 ; + +group: GeoGrid { + variables: + double YDim_GeoGrid(YDim_GeoGrid) ; + YDim_GeoGrid:units = "degrees_north" ; + YDim_GeoGrid:eos_latlon = "GeoGrid lat" ; + double XDim_GeoGrid(XDim_GeoGrid) ; + XDim_GeoGrid:units = "degrees_east" ; + XDim_GeoGrid:eos_latlon = "GeoGrid lon" ; + data: + + YDim_GeoGrid = 3.5, 2.5, 1.5, 0.5 ; + + XDim_GeoGrid = 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5 ; + + group: Data_Fields { + variables: + float temperature(YDim_GeoGrid, XDim_GeoGrid) ; + temperature:dmr_sds_ref = 5 ; + data: + + temperature = + 10, 10, 10, 10, 10, 10, 10, 10, + 11, 11, 11, 11, 11, 11, 11, 11, + 12, 12, 12, 12, 12, 12, 12, 12, + 13, 13, 13, 13, 13, 13, 13, 13 ; + } // group Data_Fields + + group: Grid_Attributes { + } // group Grid_Attributes + } // group GeoGrid +} diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_ps.hdf.dmrpp.baseline b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_ps.hdf.dmrpp.baseline index c1425ad721..efc9b5ef76 100644 --- a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_ps.hdf.dmrpp.baseline +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_ps.hdf.dmrpp.baseline @@ -1,5 +1,5 @@ - + @@ -61,7 +61,7 @@ END - 2026-03-25T20:48:03Z + 2026-06-10T13:31:17Z 3.21.1 @@ -73,7 +73,7 @@ END libdap-3.21.1 - build_dmrpp_h4 -f /Users/myang6/work/opendap/hyrax-2043/bes/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_ps.hdf -r grid_2_2d_ps.hdf.dmr -u OPeNDAP_DMRpp_DATA_ACCESS_URL -D -M + build_dmrpp_h4 -f /Users/myang6/work/opendap/hyrax-2180/bes/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_ps.hdf -r grid_2_2d_ps.hdf.dmr -u grid_2_2d_ps.hdf -D -M H4.EnableCF=false diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_ps.hdf.dmrpp_fonc.nc4.header.baseline b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_ps.hdf.dmrpp_fonc.nc4.header.baseline new file mode 100644 index 0000000000..489dae7887 --- /dev/null +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_ps.hdf.dmrpp_fonc.nc4.header.baseline @@ -0,0 +1,91 @@ +netcdf grid_2_2d_ps.hdf.dmrpp_test.bescmd_fonc { +dimensions: + YDim_NPGrid = 5 ; + XDim_NPGrid = 4 ; + YDim_SPGrid = 4 ; + XDim_SPGrid = 3 ; + +group: NPGrid { + variables: + ubyte eos_cf_projection ; + eos_cf_projection:grid_mapping_name = "polar_stereographic" ; + eos_cf_projection:straight_vertical_longitude_from_pole = -45. ; + eos_cf_projection:standard_parallel = 70. ; + eos_cf_projection:false_easting = 0. ; + eos_cf_projection:false_northing = 0. ; + eos_cf_projection:latitude_of_projection_origin = 90. ; + eos_cf_projection:_CoordinateAxisTypes = "GeoX GeoY" ; + eos_cf_projection:eos_cf_grid_mapping = "NPGrid eos_cf_projection" ; + double XDim_NPGrid(XDim_NPGrid) ; + XDim_NPGrid:standard_name = "projection_x_coordinate" ; + XDim_NPGrid:long_name = "x coordinate of projection " ; + XDim_NPGrid:units = "meter" ; + XDim_NPGrid:_CoordinateAxisType = "GeoX" ; + XDim_NPGrid:eos_cf_grid = "NPGrid XDim" ; + double YDim_NPGrid(YDim_NPGrid) ; + YDim_NPGrid:standard_name = "projection_y_coordinate" ; + YDim_NPGrid:long_name = "y coordinate of projection " ; + YDim_NPGrid:units = "meter" ; + YDim_NPGrid:_CoordinateAxisType = "GeoY" ; + YDim_NPGrid:eos_cf_grid = "NPGrid YDim" ; + double Latitude(YDim_NPGrid, XDim_NPGrid) ; + Latitude:units = "degrees_north" ; + Latitude:eos_latlon = "NPGrid lat" ; + double Longitude(YDim_NPGrid, XDim_NPGrid) ; + Longitude:units = "degrees_east" ; + Longitude:eos_latlon = "NPGrid lon" ; + + group: Data_Fields { + variables: + float Temperature(YDim_NPGrid, XDim_NPGrid) ; + Temperature:dmr_sds_ref = 5 ; + Temperature:coordinates = "/NPGrid/Longitude /NPGrid/Latitude" ; + Temperature:grid_mapping = "/NPGrid/eos_cf_projection" ; + } // group Data_Fields + + group: Grid_Attributes { + } // group Grid_Attributes + } // group NPGrid + +group: SPGrid { + variables: + ubyte eos_cf_projection ; + eos_cf_projection:grid_mapping_name = "polar_stereographic" ; + eos_cf_projection:straight_vertical_longitude_from_pole = 0. ; + eos_cf_projection:standard_parallel = -70. ; + eos_cf_projection:false_easting = 0. ; + eos_cf_projection:false_northing = 0. ; + eos_cf_projection:latitude_of_projection_origin = -90. ; + eos_cf_projection:_CoordinateAxisTypes = "GeoX GeoY" ; + eos_cf_projection:eos_cf_grid_mapping = "SPGrid eos_cf_projection" ; + double XDim_SPGrid(XDim_SPGrid) ; + XDim_SPGrid:standard_name = "projection_x_coordinate" ; + XDim_SPGrid:long_name = "x coordinate of projection " ; + XDim_SPGrid:units = "meter" ; + XDim_SPGrid:_CoordinateAxisType = "GeoX" ; + XDim_SPGrid:eos_cf_grid = "SPGrid XDim" ; + double YDim_SPGrid(YDim_SPGrid) ; + YDim_SPGrid:standard_name = "projection_y_coordinate" ; + YDim_SPGrid:long_name = "y coordinate of projection " ; + YDim_SPGrid:units = "meter" ; + YDim_SPGrid:_CoordinateAxisType = "GeoY" ; + YDim_SPGrid:eos_cf_grid = "SPGrid YDim" ; + double Latitude(YDim_SPGrid, XDim_SPGrid) ; + Latitude:units = "degrees_north" ; + Latitude:eos_latlon = "SPGrid lat" ; + double Longitude(YDim_SPGrid, XDim_SPGrid) ; + Longitude:units = "degrees_east" ; + Longitude:eos_latlon = "SPGrid lon" ; + + group: Data_Fields { + variables: + float Temperature(YDim_SPGrid, XDim_SPGrid) ; + Temperature:dmr_sds_ref = 10 ; + Temperature:coordinates = "/SPGrid/Longitude /SPGrid/Latitude" ; + Temperature:grid_mapping = "/SPGrid/eos_cf_projection" ; + } // group Data_Fields + + group: Grid_Attributes { + } // group Grid_Attributes + } // group SPGrid +} diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_sin.h5.dmrpp.baseline b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_sin.h5.dmrpp.baseline index 41ee552a4a..e7a3ac833b 100644 --- a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_sin.h5.dmrpp.baseline +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_sin.h5.dmrpp.baseline @@ -1,8 +1,8 @@ - + - 2026-04-29T18:03:20Z + 2026-06-10T13:31:23Z 3.21.1 @@ -14,7 +14,7 @@ libdap-3.21.1 - build_dmrpp -f /home/rocky/kent/hyrax-2121-test/bes/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_sin.h5 -r grid_2_2d_sin.h5.dmr -u OPeNDAP_DMRpp_DATA_ACCESS_URL -M + /Users/myang6/work/opendap/hyrax-2180/bes/modules/dmrpp_module/.libs/build_dmrpp -f /Users/myang6/work/opendap/hyrax-2180/bes/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_sin.h5 -r grid_2_2d_sin.h5.dmr -u grid_2_2d_sin.h5 -M diff --git a/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_sin.h5.dmrpp_fonc.nc4.header.baseline b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_sin.h5.dmrpp_fonc.nc4.header.baseline new file mode 100644 index 0000000000..b294cd5036 --- /dev/null +++ b/modules/dmrpp_module/get_dmrpp/unit-tests/grid_2_2d_sin.h5.dmrpp_fonc.nc4.header.baseline @@ -0,0 +1,95 @@ +netcdf grid_2_2d_sin.h5.dmrpp_test.bescmd_fonc { + +group: HDFEOS { + + group: ADDITIONAL { + + group: FILE_ATTRIBUTES { + } // group FILE_ATTRIBUTES + } // group ADDITIONAL + + group: GRIDS { + + group: SinGrid1 { + dimensions: + XDim = 2 ; + YDim = 2 ; + variables: + ubyte eos5_cf_projection ; + eos5_cf_projection:grid_mapping_name = "sinusoidal" ; + eos5_cf_projection:longitude_of_central_meridian = 0. ; + eos5_cf_projection:earth_radius = 6371007.181 ; + eos5_cf_projection:_CoordinateAxisTypes = "GeoX GeoY" ; + double XDim(XDim) ; + XDim:standard_name = "projection_x_coordinate" ; + XDim:long_name = "x coordinate of projection " ; + XDim:units = "meter" ; + XDim:_CoordinateAxisType = "GeoX" ; + double YDim(YDim) ; + YDim:standard_name = "projection_y_coordinate" ; + YDim:long_name = "y coordinate of projection " ; + YDim:units = "meter" ; + YDim:_CoordinateAxisType = "GeoY" ; + double Latitude(YDim, XDim) ; + Latitude:units = "degrees_north" ; + double Longitude(YDim, XDim) ; + Longitude:units = "degrees_east" ; + + group: Data_Fields { + variables: + float Temperature(YDim, XDim) ; + Temperature:units = "K" ; + Temperature:fullnamepath = "/HDFEOS/GRIDS/SinGrid1/Data Fields/Temperature" ; + Temperature:coordinates = "/HDFEOS/GRIDS/SinGrid1/Latitude /HDFEOS/GRIDS/SinGrid1/Longitude" ; + Temperature:grid_mapping = "/HDFEOS/GRIDS/SinGrid1/eos5_cf_projection" ; + } // group Data_Fields + } // group SinGrid1 + + group: SinGrid2 { + dimensions: + XDim = 4 ; + YDim = 4 ; + variables: + ubyte eos5_cf_projection ; + eos5_cf_projection:grid_mapping_name = "sinusoidal" ; + eos5_cf_projection:longitude_of_central_meridian = 0. ; + eos5_cf_projection:earth_radius = 6371007.181 ; + eos5_cf_projection:_CoordinateAxisTypes = "GeoX GeoY" ; + double XDim(XDim) ; + XDim:standard_name = "projection_x_coordinate" ; + XDim:long_name = "x coordinate of projection " ; + XDim:units = "meter" ; + XDim:_CoordinateAxisType = "GeoX" ; + double YDim(YDim) ; + YDim:standard_name = "projection_y_coordinate" ; + YDim:long_name = "y coordinate of projection " ; + YDim:units = "meter" ; + YDim:_CoordinateAxisType = "GeoY" ; + double Latitude(YDim, XDim) ; + Latitude:units = "degrees_north" ; + double Longitude(YDim, XDim) ; + Longitude:units = "degrees_east" ; + + group: Data_Fields { + variables: + float Temperature(YDim, XDim) ; + Temperature:units = "K" ; + Temperature:fullnamepath = "/HDFEOS/GRIDS/SinGrid2/Data Fields/Temperature" ; + Temperature:coordinates = "/HDFEOS/GRIDS/SinGrid2/Latitude /HDFEOS/GRIDS/SinGrid2/Longitude" ; + Temperature:grid_mapping = "/HDFEOS/GRIDS/SinGrid2/eos5_cf_projection" ; + } // group Data_Fields + } // group SinGrid2 + } // group GRIDS + } // group HDFEOS + +group: HDFEOS_INFORMATION { + dimensions: + StructMetadata_0_len1 = 1321 ; + variables: + char StructMetadata_0(StructMetadata_0_len1) ; + StructMetadata_0:fullnamepath = "/HDFEOS INFORMATION/StructMetadata.0" ; + + // group attributes: + :HDFEOSVersion = "HDFEOS_5.1.17" ; + } // group HDFEOS_INFORMATION +}