NOAA-GFDL / pace

Re-write of FV3GFS weather/climate model in Python
Apache License 2.0
12 stars 11 forks source link

D-grid data input method #42

Closed fmalatino closed 6 months ago

fmalatino commented 8 months ago

Purpose

Implementation of methods to allow for grid data from NetCDF (as generated by FRE-NCtools) to be read-in and used to initialize metric terms for the creation of a driver object.

The user can now specify the path for grid data files to be read-in in the configuration yaml file. Each rank will select from the files their appropriate slice of data using the subtile_slice methods included in Pace.

Code changes:

Requirements changes:

N/A

Infrastructure changes:

N/A

Checklist

Before submitting this PR, please make sure:

Additionally, if this PR contains code authored by new contributors:

lharris4 commented 7 months ago

Hi, Frank. Thank you for your explanation. So in that case, the metrics are not actually calculated until the property methods of each metric term datatype is called?

Lucas

On Mon, Dec 18, 2023 at 11:50 AM fmalatino @.***> wrote:

@.**** commented on this pull request.

In tests/mpi_54rank/test_external_grid_1x1.py https://github.com/NOAA-GFDL/pace/pull/42#discussion_r1430403791:

+

  • subtile_slice_dy = cube_comm.partitioner.tile.subtile_slice(
  • rank=cube_comm.rank,
  • global_dims=[pace.util.Y_DIM, pace.util.X_INTERFACE_DIM],
  • global_extent=(ny, npx),
  • overlap=True,
  • )
  • subtile_slice_area = cube_comm.partitioner.tile.subtile_slice(
  • rank=cube_comm.rank,
  • global_dims=[pace.util.Y_DIM, pace.util.X_DIM],
  • global_extent=(ny, nx),
  • overlap=True,
  • )
  • lon_rad = lon * (PI / 180)

@lharris4 https://github.com/lharris4 To partially address your question regarding the read-in and computation of metric terms, the open_dataset() method from xarray is used to read data, from a netcdf file type, specifically the lon and lat points from a grid data file. These points are then used to set the lon and lat points for the metric terms object generated at the time of the creation of a driver object by a PE. The remaining metric terms are then calculated, when called upon, by the "property" methods of the metric terms class, using the read in lon and lat points. If not using the read-in method, the lon and lat points will be generated by what is stated in the configuration yaml. I hope I didn't make this more confusing.

— Reply to this email directly, view it on GitHub https://github.com/NOAA-GFDL/pace/pull/42#discussion_r1430403791, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMUQRVEUHPTAE7VOXADZTE3YKBX5XAVCNFSM6AAAAABAIDXLEOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOOBXGMYTQNRRGE . You are receiving this because you were mentioned.Message ID: @.***>

fmalatino commented 7 months ago

Hi,

Yes, that is correct. Each of the terms are initialized as None types at the creation of a metric terms object and are given values at the time of their call if not already specified (as in the lon and lat types read in from this method, or when the dx and dy are set to constant values, like when specifying dx_const for a Cartesian type grid).

On Mon, Dec 18, 2023 at 3:01 PM lharris4 @.***> wrote:

Hi, Frank. Thank you for your explanation. So in that case, the metrics are not actually calculated until the property methods of each metric term datatype is called?

Lucas

On Mon, Dec 18, 2023 at 11:50 AM fmalatino @.***> wrote:

@.**** commented on this pull request.

In tests/mpi_54rank/test_external_grid_1x1.py https://github.com/NOAA-GFDL/pace/pull/42#discussion_r1430403791:

+

  • subtile_slice_dy = cube_comm.partitioner.tile.subtile_slice(
  • rank=cube_comm.rank,
  • global_dims=[pace.util.Y_DIM, pace.util.X_INTERFACE_DIM],
  • global_extent=(ny, npx),
  • overlap=True,
  • )
  • subtile_slice_area = cube_comm.partitioner.tile.subtile_slice(
  • rank=cube_comm.rank,
  • global_dims=[pace.util.Y_DIM, pace.util.X_DIM],
  • global_extent=(ny, nx),
  • overlap=True,
  • )
  • lon_rad = lon * (PI / 180)

@lharris4 https://github.com/lharris4 To partially address your question regarding the read-in and computation of metric terms, the open_dataset() method from xarray is used to read data, from a netcdf file type, specifically the lon and lat points from a grid data file. These points are then used to set the lon and lat points for the metric terms object generated at the time of the creation of a driver object by a PE. The remaining metric terms are then calculated, when called upon, by the "property" methods of the metric terms class, using the read in lon and lat points. If not using the read-in method, the lon and lat points will be generated by what is stated in the configuration yaml. I hope I didn't make this more confusing.

— Reply to this email directly, view it on GitHub https://github.com/NOAA-GFDL/pace/pull/42#discussion_r1430403791, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AMUQRVEUHPTAE7VOXADZTE3YKBX5XAVCNFSM6AAAAABAIDXLEOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOOBXGMYTQNRRGE>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/NOAA-GFDL/pace/pull/42#issuecomment-1861494796, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB6BH6SD2B4RSKMDZ6WXMULYKCOKFAVCNFSM6AAAAABAIDXLEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRRGQ4TINZZGY . You are receiving this because you were mentioned.Message ID: @.***>

-- Frank Malatino Scientific Programmer +1 609.452.5066 (work) +1 609.661.4520 (cell) SAIC/NOAA/GFDL

oelbert commented 6 months ago

Also you should add yourself to the contributors list!