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

Define new grid class to store semi-structured grid information (e.g. lat or lon vs level or time) #1954

Closed
21 tasks
JohnHalleyGotway opened this issue Oct 26, 2021 · 13 comments · Fixed by #2262
Closed
21 tasks
Assignees
Labels
alert: NEED ACCOUNT KEY Need to assign an account key to this issue MET: Library Code priority: blocker Blocker reporting: DTC NOAA R2O NOAA Research to Operations DTC Project requestor: NOAA/EMC NOAA Environmental Modeling Center requestor: NOAA/other NOAA Laboratory, not otherwise specified requestor: NOAA/PSD NOAA Physical Sciences Laboratory requestor: UK Met Office United Kingdom Met Office required: FOR DEVELOPMENT RELEASE Required to be completed in the development release for the assigned project type: new feature Make it do something new
Milestone

Comments

@JohnHalleyGotway
Copy link
Collaborator

JohnHalleyGotway commented Oct 26, 2021

Describe the New Feature

This work is related to dtcenter/METplus#??? (insert issue number here) which describes enhancing METplus for use in computing and quantifying stratospheric diagnostics. While some portions of that work will be done in Python, some enhancements to the MET code is needed as well. This top-level issue describes those changes. However, it should be further broken down into actionable pieces prior to beginning work.

  1. The stratospheric diagnostics are based on either zonal or meridional mean fields. Consider enhancing MET to derive these means on-the-fly in any tool that can process multiple input fields (including Grid-Stat and Series-Analysis). Adding it to MODE would also be useful. The meridional mean is computed by averaging data values across all latitudes for each longitude. The zonal mean is computed by averaging data values across all longitudes for each latitude. Compute the 1D mean arrays for each input level and store the meridional or zonal mean as a 2D field. One dimension is the lat or lon and the other dimension is the vertical level.

Question: Can this only be computed for LatLon inputs or should it be computed for all input projection types?

  1. Add support for a semi-structured grid type. The spatial information of the mean fields described above can be stored in a new semi-structured grid class. Recommend making this grid class flexible enough to store 5 variations of data types:
    • Zonal mean field with dimensions (lat, vertical level)
    • Meridional mean field with dimensions (lon, vertical level)
    • Vertical cross-section field with dimensions (points, vertical level) where points are located by (lat, lon) location.
    • Hovmoller field with dimensions (lat, time)
    • Hovmoller field with dimensions (lon, time)

In general, the semi-structured grid class should store (lat, lon) info for the first dimension and vertical level or time for second. Note that the xy_to_latlon() and latlon_to_xy() functions from the Grid base class warrant careful consideration.

  1. Add support a totally unstructured grid type. This is really just for storing a set of lat/lon points and corresponding data values. Those lat/lon values can probably just be stored in a 1D, rather than 2D, array. This may be useful for handling unstructured grid data from MPAS and Elfrich. Note that operations like smoothing and interpolating (other than nearest neighbor) should result in an error.

Note: Lots of additional definition is required.

Acceptance Testing

List input data types and sources.
Describe tests required for new functionality.

Time Estimate

Estimate the amount of work required here.
Issues should represent approximately 1 to 3 days of work.

Sub-Issues

Consider breaking the new feature down into sub-issues.

  • Add a checkbox for each sub-issue here.

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

Define the source of funding and account keys here or state NONE.

Define the Metadata

Assignee

  • Select engineer(s) or no engineer required
  • Select scientist(s) or no scientist required

Labels

  • Select component(s)
  • Select priority
  • Select requestor(s)

Projects and Milestone

  • Select Repository and/or Organization level Project(s) or add alert: NEED PROJECT ASSIGNMENT label
  • Select Milestone as the next official version or Future Versions

Define Related Issue(s)

Consider the impact to the other METplus components.

New Feature Checklist

See the METplus Workflow for details.

  • Complete the issue definition above, including the Time Estimate and Funding source.
  • Fork this repository or create a branch of develop.
    Branch name: feature_<Issue Number>_<Description>
  • Complete the development and test your changes.
  • Add/update log messages for easier debugging.
  • Add/update unit tests.
  • Add/update documentation.
  • Push local changes to GitHub.
  • Submit a pull request to merge into develop.
    Pull request: feature <Issue Number> <Description>
  • Define the pull request metadata, as permissions allow.
    Select: Reviewer(s) and Linked issues
    Select: Repository level development cycle Project for the next official release
    Select: Milestone as the next official version
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Close this issue.
@JohnHalleyGotway JohnHalleyGotway added type: new feature Make it do something new priority: high requestor: UK Met Office United Kingdom Met Office requestor: NOAA/other NOAA Laboratory, not otherwise specified alert: NEED MORE DEFINITION Not yet actionable, additional definition required alert: NEED ACCOUNT KEY Need to assign an account key to this issue alert: NEED CYCLE ASSIGNMENT Need to assign to a release development cycle MET: Library Code labels Oct 26, 2021
@JohnHalleyGotway JohnHalleyGotway added this to the MET 11.0.0 milestone Oct 26, 2021
@TaraJensen TaraJensen changed the title Define new classes for for semi-structured and unstructured grid types. Define new classes for semi-structured and unstructured grid types. Dec 15, 2021
@TaraJensen TaraJensen added reporting: DTC NOAA R2O NOAA Research to Operations DTC Project requestor: NOAA/EMC NOAA Environmental Modeling Center requestor: NOAA/PSD NOAA Physical Sciences Laboratory labels Dec 15, 2021
@JohnHalleyGotway JohnHalleyGotway removed the alert: NEED CYCLE ASSIGNMENT Need to assign to a release development cycle label Feb 8, 2022
@TaraJensen TaraJensen added priority: blocker Blocker required: FOR DEVELOPMENT RELEASE Required to be completed in the development release for the assigned project and removed priority: high labels Mar 17, 2022
@JohnHalleyGotway
Copy link
Collaborator Author

@CPKalb I was inclined to start working on this issue since it's marked as required for the next dev release. But Tara recommended that I touch base with you to confirm that it's still needed.

Should I work on adding support for handling these types of semi-structured grids in MET (e.g. hovmoller, meridional means, etc)? I imagine, for example, you'd run Grid-Stat using python embedding to serve up the forecast and observation data to the tool. Then Grid-Stat would compute and report statistics.

Or have you already come up with a preferred workaround in python? And I should not work on this issue?

@CPKalb
Copy link

CPKalb commented Jul 7, 2022

@JohnHalleyGotway, I have not come up with a workaround in python yet. I'm stuck on a pre-processing step. Given that the original data is 3D and that either the model or obs need to be regridded to match, I haven't decided on the best way to do this (I think regrid_data_plane needs 2d). Anyway, I don't have a workaround yet. I've been in conversation with Minna and Hank, but the RMSE calculation in METcalcpy looks like it needs a SL1L2 line type input (which we wouldn't be starting from). But, we haven't been able to test because I'm stuck in pre-processing

JohnHalleyGotway added a commit that referenced this issue Jul 7, 2022
…o run bootstrap on seneca to regenerate Makefile.in in vx_grid. Otherwise, running it on my laptop with a different autoconf version would modify all instances of Makefile.in. ci_run_unit
JohnHalleyGotway added a commit that referenced this issue Jul 7, 2022
…y and TimeArray classes and adding support to grid_base.h/.cc for the UnstructuredGrid type.
@JohnHalleyGotway
Copy link
Collaborator Author

@CPKalb I've started working on this today. I see that you'd like to run it via Series-Analysis, so I'll work on that aspect of it. FYI, based on a meeting yesterday, I created a separate issue (#2231) for handling actual UGRID data.

To avoid confusion, I'm switching from calling this an "Unstructured" grid to calling it a "SemiLatLon" grid. That is meant to imply there is some latitude or longitude information involved, but not entirely.

One clarifying question for you. I understand that we want to support (1) latitude OR longitude VERSUS level OR time. Is it also the case that we want to support (2) latitude AND longitude VERSUS level OR time?

For (2), when both latitude and longitude are provide, they would necessarily need to have the same length. Is that correct? Should (2) be supported? That's how I'm interpreting this comment from above:

Vertical cross-section field with dimensions (points, vertical level) where points are located by (lat, lon) location.

But I just wanted to confirm that my interpretation is correct.

@CPKalb
Copy link

CPKalb commented Aug 18, 2022

@JohnHalleyGotway for the stratosphere work, I think we want to have the ability to support latitude OR longitude versus level AND time. The zonal and meridional means we are doing for that work will be (latitude, level, time) and (longitude, level, time).

I guess it depends on how these go into series analysis. I'm assuming I'll need to use python embedding to put them in (since the zonal and meridional means are calculated in python). In that case, if each time step is imported separately, then I would have something like (latitude, level) and (longitude, level) for each time step. I'll have to figure out how to separate the time steps since the zonal and meridional mean code performs these on all time steps at the same time.

(2) isn't needed for my stratosphere work, but I don't know if it's needed for something else.

Tina

JohnHalleyGotway added a commit that referenced this issue Aug 19, 2022
…on code to use it when dumping info about the grid. Dumping all of the lat/lon values clutters the log output way too much.
@JohnHalleyGotway
Copy link
Collaborator Author

@CPKalb I've made good progress on this and even got grid_stat to compute stats on some sample "semilatlon" data!

Still working on updating the MET tools to read the semilatlon output written by other tools. Once that's done, I'd like you test it out. Should I just compile my feature branch somewhere on seneca for you to test out?

@CPKalb
Copy link

CPKalb commented Aug 30, 2022

Yes, that sounds good! Will I be able to use python embedding to read in the data? That will likely be the easiest way since it's already in python to compute the zonal mean.

JohnHalleyGotway added a commit that referenced this issue Aug 31, 2022
JohnHalleyGotway added a commit that referenced this issue Aug 31, 2022
…nction define lat_dim and lon_dim. These are always created within each app prior to calling write_netcdf_proj() anyway. For semilatlon grids, the choice of lat_dim and lon_dim is complex. For all other projection types its very easy.
JohnHalleyGotway added a commit that referenced this issue Aug 31, 2022
…lat_dim and lon_dim prior to calling write_netcdf_proj().
JohnHalleyGotway added a commit that referenced this issue Aug 31, 2022
…me based on whether the input grid is semilatlon or not. #ci-run-unit
JohnHalleyGotway added a commit that referenced this issue Sep 6, 2022
…by renaming nympy_array_one_to_two() to numpy_array_one_to_two().
JohnHalleyGotway added a commit that referenced this issue Sep 6, 2022
…s/lons/levels/times either as a list of value or as 1D NumPy array. On my laptop, they are served up as lists whereas on seneca, they come through as NumPy arrays.
@JohnHalleyGotway
Copy link
Collaborator Author

JohnHalleyGotway commented Sep 6, 2022

Tina, I'm finally ready for you to start testing. The wrinkle is that for some reason python serves up my lats/lons/levels/times as a Python List (on my laptop) and other times as a NumPy array (on seneca). I had to make the code flexible enough to handle both.

Please take a look on seneca and run:

cd /d1/personal/johnhg/MET/MET_development/SemiLatLon/examples
./run_examples.sh

These exercise the sample read_PostProcessed_WRF_semilatlon.py python embedding script. I hoping you can modify your other scripts to define the input data in a similar way.

Running this through Series-Analysis should technically work, but no example is provided here.

And I imagine we'll want to modify how timestamps are served up. Currently, they're just stored as a list of unixtimes.

@CPKalb
Copy link

CPKalb commented Sep 7, 2022

Great. I probably won't get to start testing until tomorrow.

JohnHalleyGotway pushed a commit that referenced this issue Sep 15, 2022
…f Point-Stat config files from which they were missing.
JohnHalleyGotway pushed a commit that referenced this issue Sep 15, 2022
…emoved unused seeps_column and seeps_thresh variables.
JohnHalleyGotway added a commit that referenced this issue Sep 15, 2022
…semilatlon functionality. Still need to update the docs.
JohnHalleyGotway added a commit that referenced this issue Sep 16, 2022
…dd Grid::is_set() function to prevent checking the GridInfo class info prior to the grid being defined.
JohnHalleyGotway added a commit that referenced this issue Sep 16, 2022
…ng fro : to _ as we've done for other similar tests.
@JohnHalleyGotway JohnHalleyGotway linked a pull request Sep 16, 2022 that will close this issue
18 tasks
@CPKalb
Copy link

CPKalb commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert: NEED ACCOUNT KEY Need to assign an account key to this issue MET: Library Code priority: blocker Blocker reporting: DTC NOAA R2O NOAA Research to Operations DTC Project requestor: NOAA/EMC NOAA Environmental Modeling Center requestor: NOAA/other NOAA Laboratory, not otherwise specified requestor: NOAA/PSD NOAA Physical Sciences Laboratory requestor: UK Met Office United Kingdom Met Office required: FOR DEVELOPMENT RELEASE Required to be completed in the development release for the assigned project type: new feature Make it do something new
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants