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

Bugfix 2968 point2grid set attr grid #2969

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Users_Guide/reformat_point.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ Only 4 interpolation methods are applied to the field variables; MIN/MAX/MEDIAN/
For the GOES-16 and GOES-17 data, the computing lat/long is time consuming. The computed coordinate (lat/long) is saved to a temporary NetCDF file, as described in :numref:`Contributor's Guide Section %s <tmp_files_point2grid>`. The computing lat/long step can be skipped if the coordinate file is given through the environment variable MET_GEOSTATIONARY_DATA. The grid mapping to the target grid is saved to MET_TMP_DIR to save the execution time. Once this file is created, the MET_GEOSTATIONARY_DATA is ignored. The grid mapping file should be deleted manually in order to apply a new MET_GEOSTATIONARY_DATA environment variable or to re-generate the grid mapping file. An example of call point2grid to process GOES-16 AOD data is shown below:


The grid name or the grid definition can be given with the -field option when the grid information is missing from the input NetCDF file for the latitude_longitude projection. The latitude and longitude variable names should be defined by the user, and the grid information from the set_attr_grid is ignored in this case
The grid name or the grid definition can be given with the -field option when the grid information is missing from the input NetCDF file for the latitude_longitude projection. The latitude and longitude variable names should be defined by the user, and the grid information from the set_attr_grid is ignored in this case except nx and ny.

.. code-block:: none

Expand Down
2 changes: 1 addition & 1 deletion internal/test_unit/xml/unit_point2grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@
G231 \
&OUTPUT_DIR;/point2grid/point2grid_cice_to_G231.nc \
-config &CONFIG_DIR;/Point2GridConfig_tlat_tlon \
-field 'name="hi_d"; level="(0,*,*)"; set_attr_grid="latlon 180 360 -80 -180 1 1";' \
-field 'name="hi_d"; level="(0,*,*)"; set_attr_grid="latlon 1440 1080 -80 -180 0.1 0.1";' \
-v 1
</param>
<output>
Expand Down
12 changes: 12 additions & 0 deletions src/libcode/vx_data2d_nc_cf/nc_cf_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,18 @@ bool NcCfFile::getData(NcVar * v, const LongArray & a, DataPlane & plane) const
const int nx = grid.nx();
const int ny = grid.ny();

size_t data_size = 1;
for (int k=0; k<dim_count; k++) {
if (a[k] == vx_data2d_star) data_size *= v->getDim(k).getSize();
}
if (data_size == 1) data_size = v->getDim(x_slot).getSize() * v->getDim(y_slot).getSize();
if (!is_eq(data_size, (size_t)nx*ny)) {
mlog << Error << "\n" << method_name
<< "Allocated DataPlane from Grid (" << nx*ny << ") does not match with the variable size ("
<< data_size << "). Please check set_attr_grid settings (nx and ny) if applied.\n\n";
exit(1);
}

plane.clear();
plane.set_size(nx, ny);

Expand Down
Loading