NOAA-EMC / RDASApp

Regional DAS
GNU Lesser General Public License v2.1
1 stars 8 forks source link

MPAS plot scripts plot incorrect domain shapes #173

Open delippi opened 1 day ago

delippi commented 1 day ago

The plotting scripts used for visualizing data on an MPAS grid is producing incorrect plots due to issues with handling concave boundaries. The scripts are intended to create contour plots for temperature increments, spread, etc., but the visual output is distorted around the concave areas of the domain.

For example, here is the ensemble spread plot with lat/lon points overlaid. The scatter points (blue) show what the domain should look like while the contour fill is trying to fill in areas that are not actually part of the domain. This can lead to confusion when interpreting plots. spread_airTemperature

This issue will track progress with updating the plotting scripts.

delippi commented 1 day ago

I'm able to get the plot to show the correct domain shape by using:

# Plot using Delaunay triangulation
triang = Triangulation(lons, lats, tri.simplices)
mask = TriAnalyzer(triang).get_flat_tri_mask(min_circle_ratio=0.1)
triang.set_mask(mask)

# Plot the variance data on the triangulation
c1 = m1.tricontourf(triang, var, cmap=cmap, levels=100, transform=ccrs.PlateCarree())

Left is before. Right is after. merged_image

guoqing-noaa commented 1 day ago

Great work. Thanks, @delippi!

delippi commented 1 day ago

And working for the increment plot as well.

Edit: Image updated

merged_increment_airTemperature

delippi commented 1 day ago

I just used scatter(lon,lat) for plotting domain area of offline domain check. We also see why 10% hull shrink is required to remove all obs that could be outside the domain (especially in the south part of the domain). merged_domain_check_MPAS_aircraft

SamuelDegelia-NOAA commented 1 day ago

Thanks @delippi this is a good find. BTW, one of my versions of the offline domain check uses a concave hull approach. That could help remove any obs inside the concave section without needing to shrink it further and remove valid obs. But that code has a problem of needing python modules that are not available with any of the RDASApp modulefiles

delippi commented 1 day ago

@SamuelDegelia-NOAA, It would be nice to be able to use the concave hull option. As you know, I purposefully did not because that required the additional python module and I wanted to use only what was currently available. We should talk to @CoryMartin-NOAA about what we might need to have additional python modules installed. But at the same time, the offline domain check is only supposed to be a temporary solution. However, the online domain check doesn't really work because you can't drop the obs from memory and then it gets caught up in other QC filters especially the ObsErrorFactorPressureCheck (ob error inflation). Not sure about progress on the online domain checks. I think since the offline check is only temporary it is probably fine as is. If for some reason we need to use the offline check as a more long term solution then we should consider adding those python modules.

SamuelDegelia-NOAA commented 1 day ago

Yeah I agree with that. For the time being I think the simpler (and faster) domain check is a good option. But if we get to the point of cycling tests (further than just the prototype phase) and the online checks are still not working, then maybe we can revisit and think about adding the concave hull approach.