easy_vic_build.bulid_Domain

Build and modify VIC domain files.

Public functions

buildDomain

Create domain.nc with mask, area, fraction, and grid-length variables.

cal_mask_frac_area_length

Compute domain mask/fraction/area/length arrays from grid and basin geometry.

modifyDomain_for_pourpoint

Force the domain mask at the nearest grid cell to a pour-point location.

addElevIntoDomain

Append elevation from level-1 parameters into the domain file.

Functions

addElevIntoDomain(evb_dir, params_dataset_level1)

Append elev variable into an existing domain file.

buildDomain(evb_dir, dpc_VIC[, reverse_lat, ...])

Build domain.nc for the current case.

cal_mask_frac_area_length(dpc_VIC[, ...])

Compute mask/fraction/area/length arrays for domain generation.

centers_to_edges(centers)

Compute grid edges from center coordinates.

generate_utm_proj_map()

Generate a global UTM zone dictionary (Zone 1-60, N/S)

modifyDomain_for_pourpoint(evb_dir, ...)

Set domain mask to 1 at the grid nearest to the pour point.

remap_level1_to_level0_mask(lon_level1, ...)

Map level-1 mask to level-0 grid by cell-center lookup.

easy_vic_build.bulid_Domain.generate_utm_proj_map() dict[source]

Generate a global UTM zone dictionary (Zone 1-60, N/S)

easy_vic_build.bulid_Domain.buildDomain(evb_dir, dpc_VIC, reverse_lat=True, basin_shp=None, prefine_mask=None)[source]

Build domain.nc for the current case.

Parameters:
  • evb_dir (Evb_dir) – Case directory manager. Output is written to evb_dir.domainFile_path.

  • dpc_VIC (object) – DPC object that provides at least grid_shp (and optionally basin_shp when basin_shp is not passed explicitly).

  • reverse_lat (bool, optional) – Whether latitude axis is arranged north-to-south.

  • basin_shp (geopandas.GeoDataFrame, optional) – Basin polygon used to compute active-grid fractions. If None, it is taken from dpc_VIC cache.

  • prefine_mask (numpy.ndarray, optional) – If provided, this array is written to mask instead of computed mask.

Return type:

None

easy_vic_build.bulid_Domain.cal_mask_frac_area_length(dpc_VIC, reverse_lat=True, plot=False, basin_shp=None)[source]

Compute mask/fraction/area/length arrays for domain generation.

Parameters:
  • dpc_VIC (object) – DPC object that provides cached grid_shp and optionally basin_shp.

  • reverse_lat (bool, optional) – Whether latitude axis is arranged north-to-south.

  • plot (bool, optional) – If True, create a quick diagnostic plot.

  • basin_shp (geopandas.GeoDataFrame, optional) – Basin polygon for intersection area calculation.

Returns:

(mask, frac_grid_in_basin, frac_full_one, area, x_length, y_length).

Return type:

tuple

easy_vic_build.bulid_Domain.modifyDomain_for_pourpoint(evb_dir, pourpoint_lon, pourpoint_lat)[source]

Set domain mask to 1 at the grid nearest to the pour point.

Parameters:
  • evb_dir (Evb_dir) – Case directory manager.

  • pourpoint_lon (float) – Pour-point longitude.

  • pourpoint_lat (float) – Pour-point latitude.

Return type:

None

easy_vic_build.bulid_Domain.addElevIntoDomain(evb_dir, params_dataset_level1)[source]

Append elev variable into an existing domain file.

Parameters:
  • evb_dir (Evb_dir) – Case directory manager.

  • params_dataset_level1 (netCDF4.Dataset) – Parameter dataset that contains elev with shape (lat, lon).

Return type:

None

easy_vic_build.bulid_Domain.centers_to_edges(centers)[source]

Compute grid edges from center coordinates.

easy_vic_build.bulid_Domain.remap_level1_to_level0_mask(lon_level1, lat_level1, mask_level1, lon_level0, lat_level0)[source]

Map level-1 mask to level-0 grid by cell-center lookup.

Each level-0 grid cell inherits the mask value of the level-1 cell in which its center falls.

Returns:

Remapped mask with (len(lat_level0), len(lon_level0)) shape.

Return type:

numpy.ndarray