Commit a340a5da authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replace obsolate CDI grid function gridInqXunits() by cdiGridInqKeyStr().

parent 72b95ff9
......@@ -320,8 +320,7 @@ void intlinarr(long nxm, double *ym, double *xm, int nx, double *y, double *x)
void intgridbil(field_t *field1, field_t *field2)
{
char units[CDI_MAX_NAME];
char xunits[CDI_MAX_NAME];
int gridID1 = field1->grid;
int gridID2 = field2->grid;
double *array1 = field1->ptr;
......@@ -359,10 +358,10 @@ void intgridbil(field_t *field1, field_t *field2)
{
if ( lon_is_circular ) lon1[nlon1-1] = 0;
gridInqXunits(gridID1, units);
gridInqXunits(gridID1, xunits);
grid_to_radian(units, nlon1, lon1, "grid1 center lon");
grid_to_radian(units, nlat1, lat1, "grid1 center lat");
grid_to_radian(xunits, nlon1, lon1, "grid1 center lon");
grid_to_radian(xunits, nlat1, lat1, "grid1 center lat");
if ( lon_is_circular ) lon1[nlon1-1] = lon1[0] + 2*M_PI;
}
......@@ -376,10 +375,10 @@ void intgridbil(field_t *field1, field_t *field2)
gridInqXvals(gridID2, &lon2);
gridInqYvals(gridID2, &lat2);
gridInqXunits(gridID2, units);
gridInqXunits(gridID2, xunits);
grid_to_radian(units, xsize2, &lon2, "grid2 center lon");
grid_to_radian(units, ysize2, &lat2, "grid2 center lat");
grid_to_radian(xunits, xsize2, &lon2, "grid2 center lon");
grid_to_radian(xunits, ysize2, &lat2, "grid2 center lat");
if ( lon2 < lon1[0] ) lon2 += 2*M_PI;
......@@ -437,10 +436,10 @@ void intgridbil(field_t *field1, field_t *field2)
gridInqXvals(gridID2, xvals2);
gridInqYvals(gridID2, yvals2);
gridInqXunits(gridID2, units);
gridInqXunits(gridID2, xunits);
grid_to_radian(units, gridsize2, xvals2, "grid2 center lon");
grid_to_radian(units, gridsize2, yvals2, "grid2 center lat");
grid_to_radian(xunits, gridsize2, xvals2, "grid2 center lon");
grid_to_radian(xunits, gridsize2, yvals2, "grid2 center lat");
for ( int i = 0; i < gridsize2; ++i )
{
......
......@@ -561,8 +561,6 @@ void grid_check_lat_borders_rad(int n, double *ybounds)
static
void remap_define_reg2d(int gridID, remapgrid_t *grid)
{
char unitstr[CDI_MAX_NAME];
long nx = grid->dims[0];
long ny = grid->dims[1];
......@@ -584,10 +582,11 @@ void remap_define_reg2d(int gridID, remapgrid_t *grid)
/* Convert lat/lon units if required */
gridInqYunits(gridID, unitstr);
char yunits[CDI_MAX_NAME]; yunits[0] = 0;
cdiGridInqKeyStr(gridID, CDI_KEY_YUNITS, CDI_MAX_NAME, yunits);
grid_to_radian(unitstr, nx, grid->reg2d_center_lon, "grid reg2d center lon");
grid_to_radian(unitstr, ny, grid->reg2d_center_lat, "grid reg2d center lat");
grid_to_radian(yunits, nx, grid->reg2d_center_lon, "grid reg2d center lon");
grid_to_radian(yunits, ny, grid->reg2d_center_lat, "grid reg2d center lat");
if ( grid->is_cyclic ) grid->reg2d_center_lon[nx] = grid->reg2d_center_lon[0] + PI2;
......@@ -638,7 +637,7 @@ void remap_define_grid(int map_type, int gridID, remapgrid_t *grid, const char *
if ( grid->dims[1] == 0 ) cdoAbort("%s grid without latitude coordinates!", gridNamePtr(gridInqType(grid->gridID)));
}
grid->is_cyclic = gridIsCircular(gridID) ? true : false;
grid->is_cyclic = (gridIsCircular(gridID) > 0);
if ( gridInqType(gridID) == GRID_UNSTRUCTURED )
grid->rank = 1;
......@@ -676,11 +675,10 @@ void remap_define_grid(int map_type, int gridID, remapgrid_t *grid, const char *
gridInqXvals(gridID, grid->cell_center_lon);
gridInqYvals(gridID, grid->cell_center_lat);
char xunitstr[CDI_MAX_NAME];
char yunitstr[CDI_MAX_NAME];
gridInqXunits(gridID, xunitstr);
gridInqYunits(gridID, yunitstr);
char xunits[CDI_MAX_NAME]; xunits[0] = 0;
char yunits[CDI_MAX_NAME]; yunits[0] = 0;
cdiGridInqKeyStr(gridID, CDI_KEY_XUNITS, CDI_MAX_NAME, xunits);
cdiGridInqKeyStr(gridID, CDI_KEY_YUNITS, CDI_MAX_NAME, yunits);
if ( grid->lneed_cell_corners )
{
......@@ -691,8 +689,8 @@ void remap_define_grid(int map_type, int gridID, remapgrid_t *grid, const char *
}
else if ( lgrid_gen_bounds )
{
grid_cell_center_to_bounds_X2D(xunitstr, grid->dims[0], grid->dims[1], grid->cell_center_lon, grid->cell_corner_lon, 0);
grid_cell_center_to_bounds_Y2D(yunitstr, grid->dims[0], grid->dims[1], grid->cell_center_lat, grid->cell_corner_lat);
grid_cell_center_to_bounds_X2D(xunits, grid->dims[0], grid->dims[1], grid->cell_center_lon, grid->cell_corner_lon, 0);
grid_cell_center_to_bounds_Y2D(yunits, grid->dims[0], grid->dims[1], grid->cell_center_lat, grid->cell_corner_lat);
}
else
{
......@@ -705,13 +703,13 @@ void remap_define_grid(int map_type, int gridID, remapgrid_t *grid, const char *
/* Convert lat/lon units if required */
grid_to_radian(xunitstr, grid->size, grid->cell_center_lon, "grid center lon");
grid_to_radian(yunitstr, grid->size, grid->cell_center_lat, "grid center lat");
grid_to_radian(xunits, grid->size, grid->cell_center_lon, "grid center lon");
grid_to_radian(yunits, grid->size, grid->cell_center_lat, "grid center lat");
/* Note: using units from cell center instead from bounds */
if ( grid->num_cell_corners && grid->lneed_cell_corners )
{
grid_to_radian(xunitstr, grid->num_cell_corners*grid->size, grid->cell_corner_lon, "grid corner lon");
grid_to_radian(yunitstr, grid->num_cell_corners*grid->size, grid->cell_corner_lat, "grid corner lat");
grid_to_radian(xunits, grid->num_cell_corners*grid->size, grid->cell_corner_lon, "grid corner lon");
grid_to_radian(yunits, grid->num_cell_corners*grid->size, grid->cell_corner_lat, "grid corner lat");
}
if ( lgrid_destroy ) gridDestroy(gridID);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment