convert_lc_ascii_to_nc#

mhm_tools.pre.landcover_ascii_to_nc.convert_lc_ascii_to_nc(input_nml: str | Path, output: str | Path, var_name: str | None = 'land_cover', normalize_latlon: bool = False) None[source]#

Workflow for converting landcover ASCII files to NetCDF.

  1. Parse mHM namelist for landcover blocks (paths, years).

  2. Read each ASCII landcover file into xarray.

  3. Concatenate along new ‘time’ dimension.

  4. Add CF-style numeric time + time_bnds.

  5. Write NetCDF.

Notes

  • Supports any number of ASCII tiles (1, 2, …).

  • The last time bound ends at (max(year_end)+1)-01-01.

  • By default the data variable is called ‘land_cover’. You can override that with var_name=….