ESMG / gridtools

A collection of grid generation tools.
Other
18 stars 15 forks source link

FMS version 1 data type errors; no land points #22

Open jr3cermak opened 2 years ago

jr3cermak commented 2 years ago

gridtools rel 0.3.3 does not work for building a small test problem for FMS version 1.0. Currently debugging proper data types for ocean_hgrid, mosaic and exchange grid files.

jr3cermak commented 2 years ago

Gridtools will create all three exchange files by default:

$ ncdump mosaic.nc 
netcdf mosaic {
dimensions:
    string = 255 ;
    nfile_aXo = 1 ;
    nfile_aXl = 1 ;
    nfile_lXo = 1 ;
variables:
    char atm_mosaic_dir(string) ;
        atm_mosaic_dir:standard_name = "directory_storing_atmosphere_mosaic" ;
    char atm_mosaic_file(string) ;
        atm_mosaic_file:standard_name = "atmosphere_mosaic_file_name" ;
    char atm_mosaic(string) ;
        atm_mosaic:standard_name = "atmosphere_mosaic_name" ;
    char lnd_mosaic_dir(string) ;
        lnd_mosaic_dir:standard_name = "directory_storing_land_mosaic" ;
    char lnd_mosaic_file(string) ;
        lnd_mosaic_file:standard_name = "land_mosaic_file_name" ;
    char lnd_mosaic(string) ;
        lnd_mosaic:standard_name = "land_mosaic_name" ;
    char ocn_mosaic_dir(string) ;
        ocn_mosaic_dir:standard_name = "directory_storing_ocean_mosaic" ;
    char ocn_mosaic_file(string) ;
        ocn_mosaic_file:standard_name = "ocean_mosaic_file_name" ;
    char ocn_mosaic(string) ;
        ocn_mosaic:standard_name = "ocean_mosaic_name" ;
    char ocn_topog_dir(string) ;
        ocn_topog_dir:standard_name = "directory_storing_ocean_topog" ;
    char ocn_topog_file(string) ;
        ocn_topog_file:standard_name = "ocean_topog_file_name" ;
    char aXo_file(nfile_aXo, string) ;
        aXo_file:standard_name = "atmXocn_exchange_grid_file" ;
    char aXl_file(nfile_aXl, string) ;
        aXl_file:standard_name = "atmXlnd_exchange_grid_file" ;
    char lXo_file(nfile_lXo, string) ;
        lXo_file:standard_name = "lndXocn_exchange_grid_file" ;

// global attributes:
        :grid_version = "0.2" ;
        :code_version = "ESMG/gridtools: 0.3.2+e933cc5" ;
        :history = "2022-05-11: gridtools.grid.mom6.convert_ROMS_to_MOM6 + kwargs" ;
data:

 atm_mosaic_dir = "./" ;

 atm_mosaic_file = "ocean_mosaic.nc" ;

 atm_mosaic = "atmos_mosaic" ;

 lnd_mosaic_dir = "./" ;

 lnd_mosaic_file = "ocean_mosaic.nc" ;

 lnd_mosaic = "land_mosaic" ;

 ocn_mosaic_dir = "./" ;

 ocn_mosaic_file = "ocean_mosaic.nc" ;

 ocn_mosaic = "ocean_mosaic" ;

 ocn_topog_dir = "./" ;

 ocn_topog_file = "ocean_topog.nc" ;

 aXo_file =
  "atmos_mosaic_tile1Xocean_mosaic_tile1.nc" ;

 aXl_file =
  "atmos_mosaic_tile1Xland_mosaic_tile1.nc" ;

 lXo_file =
  "land_mosaic_tile1Xocean_mosaic_tile1.nc" ;
}

If there are no land points, gridtools should not create these exchange files.

FRE-ncTools:

$ ncdump mosaic.nc 
netcdf mosaic {
dimensions:
    string = 255 ;
    nfile_aXo = 1 ;
    nfile_lXo = 1 ;
variables:
    char atm_mosaic_dir(string) ;
        atm_mosaic_dir:standard_name = "directory_storing_atmosphere_mosaic" ;
    char atm_mosaic_file(string) ;
        atm_mosaic_file:standard_name = "atmosphere_mosaic_file_name" ;
    char atm_mosaic(string) ;
        atm_mosaic:standard_name = "atmosphere_mosaic_name" ;
    char lnd_mosaic_dir(string) ;
        lnd_mosaic_dir:standard_name = "directory_storing_land_mosaic" ;
    char lnd_mosaic_file(string) ;
        lnd_mosaic_file:standard_name = "land_mosaic_file_name" ;
    char lnd_mosaic(string) ;
        lnd_mosaic:standard_name = "land_mosaic_name" ;
    char ocn_mosaic_dir(string) ;
        ocn_mosaic_dir:standard_name = "directory_storing_ocean_mosaic" ;
    char ocn_mosaic_file(string) ;
        ocn_mosaic_file:standard_name = "ocean_mosaic_file_name" ;
    char ocn_mosaic(string) ;
        ocn_mosaic:standard_name = "ocean_mosaic_name" ;
    char ocn_topog_dir(string) ;
        ocn_topog_dir:standard_name = "directory_storing_ocean_topog" ;
    char ocn_topog_file(string) ;
        ocn_topog_file:standard_name = "ocean_topog_file_name" ;
    char aXo_file(nfile_aXo, string) ;
        aXo_file:standard_name = "atmXocn_exchange_grid_file" ;
    char lXo_file(nfile_lXo, string) ;
        lXo_file:standard_name = "lndXocn_exchange_grid_file" ;

// global attributes:
        :grid_version = "0.2" ;
        :code_version = "$Name: fre-nctools-bronx-10 $" ;
        :history = "make_coupler_mosaic --atmos_mosaic atmos_mosaic.nc --ocean_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc" ;
data:

 atm_mosaic_dir = "./" ;

 atm_mosaic_file = "atmos_mosaic.nc" ;

 atm_mosaic = "atmos_mosaic" ;

 lnd_mosaic_dir = "./" ;

 lnd_mosaic_file = "atmos_mosaic.nc" ;

 lnd_mosaic = "atmos_mosaic" ;

 ocn_mosaic_dir = "./" ;

 ocn_mosaic_file = "ocean_mosaic.nc" ;

 ocn_mosaic = "ocean_mosaic" ;

 ocn_topog_dir = "./" ;

 ocn_topog_file = "ocean_topog.nc" ;

 aXo_file =
  "atmos_mosaic_tile1Xocean_mosaic_tile1.nc" ;

 lXo_file =
  "atmos_mosaic_tile1Xocean_mosaic_tile1.nc" ;
}
jr3cermak commented 2 years ago

Fix handling of tile variable so it is NC_CHAR type instead of string.

$ ncdump -h ocean_hgrid_t.nc 
netcdf ocean_hgrid_t {
dimensions:
    nyp = 9 ;
    nxp = 9 ;
    string = 5 ;
    nx = 8 ;
    ny = 8 ;

    char tile(string) ;

data:

 tile = "tile1" ;
}
jr3cermak commented 2 years ago

With land points:

$ ncdump mosaic.nc 
netcdf mosaic {
dimensions:
    string = 255 ;
    nfile_aXo = 1 ;
    nfile_aXl = 1 ;
    nfile_lXo = 1 ;
variables:
    char atm_mosaic_dir(string) ;
        atm_mosaic_dir:standard_name = "directory_storing_atmosphere_mosaic" ;
    char atm_mosaic_file(string) ;
        atm_mosaic_file:standard_name = "atmosphere_mosaic_file_name" ;
    char atm_mosaic(string) ;
        atm_mosaic:standard_name = "atmosphere_mosaic_name" ;
    char lnd_mosaic_dir(string) ;
        lnd_mosaic_dir:standard_name = "directory_storing_land_mosaic" ;
    char lnd_mosaic_file(string) ;
        lnd_mosaic_file:standard_name = "land_mosaic_file_name" ;
    char lnd_mosaic(string) ;
        lnd_mosaic:standard_name = "land_mosaic_name" ;
    char ocn_mosaic_dir(string) ;
        ocn_mosaic_dir:standard_name = "directory_storing_ocean_mosaic" ;
    char ocn_mosaic_file(string) ;
        ocn_mosaic_file:standard_name = "ocean_mosaic_file_name" ;
    char ocn_mosaic(string) ;
        ocn_mosaic:standard_name = "ocean_mosaic_name" ;
    char ocn_topog_dir(string) ;
        ocn_topog_dir:standard_name = "directory_storing_ocean_topog" ;
    char ocn_topog_file(string) ;
        ocn_topog_file:standard_name = "ocean_topog_file_name" ;
    char aXo_file(nfile_aXo, string) ;
        aXo_file:standard_name = "atmXocn_exchange_grid_file" ;
    char aXl_file(nfile_aXl, string) ;
        aXl_file:standard_name = "atmXlnd_exchange_grid_file" ;
    char lXo_file(nfile_lXo, string) ;
        lXo_file:standard_name = "lndXocn_exchange_grid_file" ;

// global attributes:
        :grid_version = "0.2" ;
        :code_version = "$Name: fre-nctools-bronx-10 $" ;
        :history = "make_coupler_mosaic --atmos_mosaic atmos_mosaic.nc --land_mosaic land_mosaic.nc --ocean_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc" ;
data:

 atm_mosaic_dir = "./" ;

 atm_mosaic_file = "atmos_mosaic.nc" ;

 atm_mosaic = "atmos_mosaic" ;

 lnd_mosaic_dir = "./" ;

 lnd_mosaic_file = "land_mosaic.nc" ;

 lnd_mosaic = "land_mosaic" ;

 ocn_mosaic_dir = "./" ;

 ocn_mosaic_file = "ocean_mosaic.nc" ;

 ocn_mosaic = "ocean_mosaic" ;

 ocn_topog_dir = "./" ;

 ocn_topog_file = "ocean_topog.nc" ;

 aXo_file =
  "atmos_mosaic_tile1Xocean_mosaic_tile1.nc" ;

 aXl_file =
  "atmos_mosaic_tile1Xland_mosaic_tile1.nc" ;

 lXo_file =
  "land_mosaic_tile1Xocean_mosaic_tile1.nc" ;
}

There are two possible modes of operation. If it is known that no land points exist, we can exclude the --land_mosaic option and get a second possible solution.

Without land points:

$ ncdump mosaic.nc 
netcdf mosaic {
dimensions:
    string = 255 ;
    nfile_aXo = 1 ;
    nfile_lXo = 1 ;
variables:
    char atm_mosaic_dir(string) ;
        atm_mosaic_dir:standard_name = "directory_storing_atmosphere_mosaic" ;
    char atm_mosaic_file(string) ;
        atm_mosaic_file:standard_name = "atmosphere_mosaic_file_name" ;
    char atm_mosaic(string) ;
        atm_mosaic:standard_name = "atmosphere_mosaic_name" ;
    char lnd_mosaic_dir(string) ;
        lnd_mosaic_dir:standard_name = "directory_storing_land_mosaic" ;
    char lnd_mosaic_file(string) ;
        lnd_mosaic_file:standard_name = "land_mosaic_file_name" ;
    char lnd_mosaic(string) ;
        lnd_mosaic:standard_name = "land_mosaic_name" ;
    char ocn_mosaic_dir(string) ;
        ocn_mosaic_dir:standard_name = "directory_storing_ocean_mosaic" ;
    char ocn_mosaic_file(string) ;
        ocn_mosaic_file:standard_name = "ocean_mosaic_file_name" ;
    char ocn_mosaic(string) ;
        ocn_mosaic:standard_name = "ocean_mosaic_name" ;
    char ocn_topog_dir(string) ;
        ocn_topog_dir:standard_name = "directory_storing_ocean_topog" ;
    char ocn_topog_file(string) ;
        ocn_topog_file:standard_name = "ocean_topog_file_name" ;
    char aXo_file(nfile_aXo, string) ;
        aXo_file:standard_name = "atmXocn_exchange_grid_file" ;
    char lXo_file(nfile_lXo, string) ;
        lXo_file:standard_name = "lndXocn_exchange_grid_file" ;

// global attributes:
        :grid_version = "0.2" ;
        :code_version = "$Name: fre-nctools-bronx-10 $" ;
        :history = "make_coupler_mosaic --atmos_mosaic atmos_mosaic.nc --land_mosaic land_mosaic.nc --ocean_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc" ;
data:

 atm_mosaic_dir = "./" ;

 atm_mosaic_file = "atmos_mosaic.nc" ;

 atm_mosaic = "atmos_mosaic" ;

 lnd_mosaic_dir = "./" ;

 lnd_mosaic_file = "land_mosaic.nc" ;

 lnd_mosaic = "land_mosaic" ;

 ocn_mosaic_dir = "./" ;

 ocn_mosaic_file = "ocean_mosaic.nc" ;

 ocn_mosaic = "ocean_mosaic" ;

 ocn_topog_dir = "./" ;

 ocn_topog_file = "ocean_topog.nc" ;

 aXo_file =
  "atmos_mosaic_tile1Xocean_mosaic_tile1.nc" ;

 lXo_file =
  "land_mosaic_tile1Xocean_mosaic_tile1.nc" ;
}

If it is known that no land points exist:

$ ncdump mosaic.nc 
netcdf mosaic {
dimensions:
    string = 255 ;
    nfile_aXo = 1 ;
    nfile_lXo = 1 ;
variables:
    char atm_mosaic_dir(string) ;
        atm_mosaic_dir:standard_name = "directory_storing_atmosphere_mosaic" ;
    char atm_mosaic_file(string) ;
        atm_mosaic_file:standard_name = "atmosphere_mosaic_file_name" ;
    char atm_mosaic(string) ;
        atm_mosaic:standard_name = "atmosphere_mosaic_name" ;
    char lnd_mosaic_dir(string) ;
        lnd_mosaic_dir:standard_name = "directory_storing_land_mosaic" ;
    char lnd_mosaic_file(string) ;
        lnd_mosaic_file:standard_name = "land_mosaic_file_name" ;
    char lnd_mosaic(string) ;
        lnd_mosaic:standard_name = "land_mosaic_name" ;
    char ocn_mosaic_dir(string) ;
        ocn_mosaic_dir:standard_name = "directory_storing_ocean_mosaic" ;
    char ocn_mosaic_file(string) ;
        ocn_mosaic_file:standard_name = "ocean_mosaic_file_name" ;
    char ocn_mosaic(string) ;
        ocn_mosaic:standard_name = "ocean_mosaic_name" ;
    char ocn_topog_dir(string) ;
        ocn_topog_dir:standard_name = "directory_storing_ocean_topog" ;
    char ocn_topog_file(string) ;
        ocn_topog_file:standard_name = "ocean_topog_file_name" ;
    char aXo_file(nfile_aXo, string) ;
        aXo_file:standard_name = "atmXocn_exchange_grid_file" ;
    char lXo_file(nfile_lXo, string) ;
        lXo_file:standard_name = "lndXocn_exchange_grid_file" ;

// global attributes:
        :grid_version = "0.2" ;
        :code_version = "$Name: fre-nctools-bronx-10 $" ;
        :history = "make_coupler_mosaic --atmos_mosaic atmos_mosaic.nc --ocean_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc" ;
data:

 atm_mosaic_dir = "./" ;

 atm_mosaic_file = "atmos_mosaic.nc" ;

 atm_mosaic = "atmos_mosaic" ;

 lnd_mosaic_dir = "./" ;

 lnd_mosaic_file = "atmos_mosaic.nc" ;

 lnd_mosaic = "atmos_mosaic" ;

 ocn_mosaic_dir = "./" ;

 ocn_mosaic_file = "ocean_mosaic.nc" ;

 ocn_mosaic = "ocean_mosaic" ;

 ocn_topog_dir = "./" ;

 ocn_topog_file = "ocean_topog.nc" ;

 aXo_file =
  "atmos_mosaic_tile1Xocean_mosaic_tile1.nc" ;

 lXo_file =
  "atmos_mosaic_tile1Xocean_mosaic_tile1.nc" ;
}
jr3cermak commented 2 years ago
jr3cermak commented 2 years ago

Small toy grid problem proceeding further with fixes to the exp/rel033 branch.