Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetCDF: Invalid dimension ID or name: Error getting dimension id MISSING #927

Open
ednisle opened this issue Aug 26, 2022 · 1 comment
Open

Comments

@ednisle
Copy link

ednisle commented Aug 26, 2022

  • VIC.5.1.0.rc2
  • linux-ubuntu 20.4

I am trying to run VIC.5.1.0.rc2/vic/drivers/image and it gives me the following error:
../shared_image/src/get_nc_dimension.c:42: errno: NetCDF: Invalid dimension ID or name: Error getting dimension id MISSING in /home/edna/Desktop/datosedna/domain_file.nc

I have already checked my domain_file.nc several times
and has the correct dimensions ands names:

<class 'netCDF4._netCDF4.Dataset'>
root group (NETCDF3_64BIT_OFFSET data model, file format NETCDF3):
history: Thu Aug 25 12:05:31 2022: ncks -6 domain_file.nc netCDF3_64bit_offset.nc
NCO: netCDF Operators version 4.9.1 (Homepage = http://nco.sf.net/, Code = http://github.com/nco/nco)
dimensions(sizes): lat(107), lon(99), month(12)
variables(dimensions): float64 AREA(lat, lon), float64 FRAC(lat, lon), int32 MASK(lat, lon), float64 dur(month, lat, lon), float64 lat(lat), float64 lon(lon) , int32 month(month), float64 t_pk(month, lat, lon)
groups:

Try running the program using the sample data from
FindleyLake and the error is the same.

Does anyone know how I can correct the error or what is the cause?

@ednisle
Copy link
Author

ednisle commented Sep 27, 2022

I fixed the error by assigning the domain file variable names in the get_domain_type function (in get_global_domain.c):

get_domain_type(char *cmdstr)
{
extern domain_struct global_domain;

char                 optstr[MAXSTRING];
char                 ncvarname[MAXSTRING];

strcpy(ncvarname, "MISSING");

sscanf(cmdstr, "%*s %s %s", optstr, ncvarname);

// Lattitude variable name
if (strcasecmp("LAT", optstr) == 0) {
    strcpy(global_domain.info.lat_var, "lat");
}
// Longitude variable name
else if (strcasecmp("LON", optstr) == 0) {
    strcpy(global_domain.info.lon_var, "lon");
}
// Mask variable name
else if (strcasecmp("MASK", optstr) == 0) {
    strcpy(global_domain.info.mask_var, "mask");
}
// Area variable name
else if (strcasecmp("AREA", optstr) == 0) {
    strcpy(global_domain.info.area_var, "area");
}
// Fraction variable name
else if (strcasecmp("FRAC", optstr) == 0) {
    strcpy(global_domain.info.frac_var, "frac");
}
// y dimension name
else if (strcasecmp("YDIM", optstr) == 0) {
    strcpy(global_domain.info.y_dim, "lat");
}
// x dimension name
else if (strcasecmp("XDIM", optstr) == 0) {
    strcpy(global_domain.info.x_dim, "lon");
}
else {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant