-
Notifications
You must be signed in to change notification settings - Fork 17
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
Interpolation to grids with <= 3 km grid spacing produces too smooth of height field #8
Comments
Hi Miles, Peter is out this week but I can try to help. I agree the height field is too smooth, and I think it's straightforward to use a higher resolution intermediate cubed-sphere grid if that is indeed the issue. But first, can you confirm some settings in experiment_settings.make? In particular, ncube_sph_smooth_coarse I think I've described to you that you need a refinement factor in the SCRIP file if lregional_refinement=T. And that the other two settings describe the smoothing radius of the base resolution (15km in your case). I'm wondering if it's using the smoothing radius at the base resolution everywhere on the grid? |
Hey @adamrher thanks for the quick reply. That would be great if you could double check my settings. Here are my experiement settings: ifeq ($(case),mpas_15-3-conus_Co009_ridge)
export ncube_sph_smooth_coarse=009
export output_grid=mpas_15-3
export grid_descriptor_fname=$(PWD)/cube_to_target/inputdata/grid-descriptor-file/mpasa15-3.conus.desc_SCRIP.210504.nc
export nwindow_halfwidth=006
export rdgwin=_Nsw$(nwindow_halfwidth)
export stitch=-stitch
export ncube=3000
export lregional_refinement=.true.
export rrfac_max=007
case_found=
endif You can find my SCRIP file, with However, what I did to calculate When looking at the result, the rrfac value was between 1.0 and 7.525. You email said to use 1 for 15 km and 15 / 3 for 3 km. The code I used to calculate rrfac is here: https://github.com/MiCurry/calc_rrfac/blob/master/calc_rrfac.py Let me know what your thoughts are on that. |
Those parameters look right. Which is odd b/c your smoothed file (top plot) looks like something you would expect from something closer to 28km grid. As a sanity check, would you be able to plot either the CAM-SE CONUS or the global 14km topo files for comparison? /glade/p/cesmdata/cseg/inputdata/atm/cam/topo/se/ne30x8_CONUS_nc3000_Co060_Fi001_MulG_PF_RR_Nsw042_c200428.nc As an aside, I also see that for SE, we are setting ncube_sph_smooth_coarse=008 and nwindow_halfwidth=5 for the global 14km grid (ne240pg3), so I'd probably use those parameters for ur mpas-conus grid instead. I also don't understand how this is a problem with the 1km->3km interpolation. I say that b/c you have the 3km intermediate cubed sphere topofile mapped to the mpas grid, right? And it look more-or-less what we want? If so the 3km source gives the right answer on the mpas grid, and so I suspect it's something in the 3km->target grid smoothing, i.e, cube_to_target. Lastly, I had thought that the mpas var-res grids were derived from an analytical density function rho(x,y). If so I would think another way to compute the rrfac is to evaluate the density function at cell centers and normalize by the lowest density point on the grid. Maybe this is an outdated workflow ... I recall if from an old mpas paper. |
one more suggestion. As u r trying to just debug this, when running cube_to_target, I would turn off the ridge finder by settting: export rdgwin=_NoAniso ... That should cut down cube_to_target to closer to a half-hour execution time (instead of ~3hrs). |
Thanks for all the help and suggestions @adamrher. I just tried changing The tool I used to generate the plots above specifically use the MPAS grid field. Do you have scrip files for the files below for plot.nc thats in
I'll give those a try out.
The 1 km -> 3 km interpolation might be correct, but our thinking was that if we are interpolating from a 3 km cube sphere to a 3 km target grid then perhaps we are not 100 % preserving the 3 km details of the cube sphere. i.e. the interpolation of 3 km to any grid spaces would have a resolution of lower than the 3 km cube sphere. That's at least my interpretation of what might be happening. Perhaps because this tool computes overlap weights that it might be better at preserving detail than I suspect?
My understanding was that the 3km source grid was upon a cube sphere. And cube_to_target takes this cube sphere file and interpolates it to the target grid, regardless of the target_grid. Is that correct?
The density function is only used when the variable resolution meshes are created and are not stored within the mesh. I believe they are somewhere on some filesystem, but using them in any means would be a lot of unnecessary work. I don't think we want to be using those. My suggestion for calculating
|
Hi Miles, I'll respond to you in detail later. But I wanted to first point you to the requested scrip files: the ne240pg3 is not in the repo (@cacraigucar can we do this? You're going to ask me to add metadata aren't ya), but it's here: |
It does not call bin_to_cube. You need to go into the bin_to_cube folder and generate the executable, and then run the run.sh shell script (this doesn't take long at all). You could experiment with ncube=9000 for debugging purposes, but it's not really a solution b/c 3km was chosen to provide SGH30 for the Beljaars pbl form drag scheme. That is, Beljaars is expecting a subgrid variance for length scales below 3km. But also note that the "stitch" modifier is important in
It might be instructive to layout the workflow in cube_to_target. (1) remap the rrfac to the 3km grid, (2) smooth the topo fields on the 3km grid using the smoothing radius determined by So you should expect the fields to be smoother than the 3km grid (although I suppose we would need to ensure that
You can search initials ARH to find relevant mods, and how I'm calling it in the script. |
If you want a head start for plotting the 3km grid, you could use my ncl script: Although its kind of messy and you'll probably have to uncomment some stuff. |
I forgot to respond to your suggestion to compute rrfac as a part of the TopoCESM2 package. Both of your points are good ones. One problem I can think of is that the spectral element grid is a special case. The SCRIP grid only provides the computational grid, which is highly anisotropic. This is because each element contains unequally spaced GLL nodes, and we invent control volumes around those nodal points that results in large differences in control volumes in a single element. Here's an example of what the control volumes look like in a particular coarse uniform spectral element grid: Because of this, I compute the rrfac on the element grid, which is not available from the SCRIP grid file. The tool that does this is in our toolkit (https://github.com/ESMCI/Community_Mesh_Generation_Toolkit), which is our feeble attempt to standardize this for cam-se grids. But I agree with you that it's not ideal for us to be messing with the well established definition of a scrip grid file. |
@PeterHjortLauritzen @adamrher thanks again for the meeting today. Here is the plot of rrfac for the 15-3 grid with its refinement over CONUS: It uses the code in calc_rrfac and calculates rrfac using the sphere distance from the cell center to a randomly selected cell corner (the first grid corner in the cells list) and then takes the ratio of the max computed distance to each distance. A few things to note about the plot above that might be noteworthy. First is that the SCRIP grid that we use for topography is on a unit sphere. All fields are scaled to be on a unit sphere. In standalone MPAS, we blow the fields up by an earth radius when we apply static, terrestrial fields (terrain, snow-albedo, vegetation fraction etc.). The other thing is that all latitude and longitude values are in radians and not degrees. I had to convert the latitude and longitude into degrees. Is it possible that that might have an effect? I think the strange banding at the top of the refined region (and other places) might be matte pattern caused by the plot, but I'm not sure. However, the several darker spots outside the refine region are consistent with the MPAS grid areas. I'm generating a plot of the MPAS grid areas field for a comparison. Is it possible that the radian latitude and longitude values have an effect or the fact that the SCRIP grid is on the unit sphere? |
@MiCurry can you point me to the SCRIP grid file and the plot_rrfac.ncl script you used to plot this? I want to try a few things to see if the ugly parts are a plotting artifact.
The area in the SCRIP files should be in radians^2, and assumed a sphere of unit radius 1 (so the global integral should be 4 * pi * 1^2). The lat lon values should be in degrees. I'm looking at scrip file that we know works w/ the topo software and I can see that longitudes use the convention [0,360] instead of [-180,180]: Which convention do your converted values correspond to? |
Thanks Miles and Adam! rrfac looks reasonable. It seems likely that the lat-lon's are 180 degrees off => you might be using rough topography 180 degrees displaced (so not over the US but in the low resolution area and smooth topography in the refinement area). |
@adamrher I'm using the scrip file found in: The lat and long values in the scrip file are from [0, 2pi], and translated they are from [0, 360]. Perhaps we can update this tool to translate radians to degrees? We could check the units of each field and translate accordingly. SCRIP files can either have radians or degrees as units for its coordinates:
The areas are in radians^2. |
@adamrher: can we overwrite height with refinement factor on the 3km intermediate cubed-sphere so we can map height (refinement factor) to the target grid and see if it is displaced or not? |
@MiCurry the ugliness was a plotting issue. I've found that CellFill doesn't like cylindrical equidistant plots for some reason. If I change it to an orthographic projection it's much happier:
|
Actually I had suggested that we just output the 3km cubed-sphere rrfac, since I've hacked my cube_to_target.F90 to do that:
@MiCurry would you be willing to copy those mods into your cube_to_target.F90? If not, we could do what Peter suggested. |
Here's a plot that uses @adamrher I can give either that or Peter's suggestion a try. The Topo software is still taking quite a while to run quite longer than 30 mins (more than a few hours), even with the ridge analysis turned off. Any idea why this might be happening? |
not sure why it's taking so long. I usually run on a login node so I can track where it's at. Do you know where it is stalling? The area approach seems to be a more straightforward method, and gives marginally cleaner results. Setting rrfac_max=5 will clean up the refinement zone so it's all green. |
Hi @MiCurry, I think you should def. proceed with writing out rrfac on the intermediate cubed sphere grid via the mods I pointed you to ... but, to help debug, I made you a 1.5km intermediate cubed sphere dataset if you want to experiment with that as well: I'd set This is with the new CAM topo, so the Antarctic peninsula issue is fixed. That means you also have to update the code as I merged some changes necessary to run this dataset last week. |
Hi @adamrher, yes I think outputing rrfact and seeing if it looks correct is a good next step. And great! Thanks for creating that. I'll give that a try as well (perhaps next week). If you point me to a branch, I can merge in your code changes. |
I think I may have found the issue: Even with Topo/cube_to_target/cube_to_target.F90 Line 200 in c36f768
The following is being reported in make:
Its simply not being set in the
Here is the experiment_settings.make I'm using:
However, it looks like lregional_refinement is being output into Does someone else want to confirm this? |
ruh roh. I'll try and run the arctic grid when I have time and update this issue w/ what I find. glad you found the issue! |
@adamrher Actually I think I was wrong with that. Not sure why its not working for my current case.. But let me know if you see it work or not work for you. |
Running the artic case I see that |
Sorry about the delay getting back, I was taking PTO on Thursday and Friday. I re-plotted rrfac on the cube sphere and got the same as what I got before. I think what is occurring is that terrain is being interpolated to the cube sphere and then it is being limited to the specified max rrfac, 20. Hence, we see values of 20 on all the land masses, 0 on the ocean, and negative terrain values (e.g the Caspian sea). During the run, the following is reported:
Hence confirming my suspicions.. This function call is most likely incorrect: Topo/cube_to_target/cube_to_target.F90 Lines 355 to 364 in c36f768
For that run, I got the following terrain, which is what we have seen before: Out of curiosity I tried running the 60km - 3 km without lregional_refinemnet = True and I got something with better resolved terrain. ncube_sph_smooth_coarse=010 and nwindow_halfwidth=007 and with ncube_sphere_smooth_coarse=005 and nwindow_halfwidth=007 is even better: For comparison, here is the interpolated terrain for the 60-3 km using standalone MPAS. The global plots of the standalone MPAS and CAM Topo run with no regional regiment i.e. outside of the 3 km region. |
@MiCurry Ah, I didn't realize that the plot that looks like a land fraction plot is actually the rrfac. That went over my head last week. But I see how that can happen if rrfac is taken on the values of terrain height. The way smooth_intermediate_topo_wrap is supposed to work for the code block you've highlighted, is it smoothes rrfac since rrfac is too choppy after we map it from the SCRIP grid to the 3km intermediate cube sphere. The subroutine takes the first argument ("rrfac_tmp") and smoothes it according to the smoothing radius ("NSCL_c"), with the radius modified by the last argument which is the refinement factor ("rrfac_tmp"). In my mind the problem is either (1) for some reason it is not running this routine and grabbing the smoothed .dat file of the terrain height instead, or (2) rrfac_tmp does not contain the refinement factor, but rather the terrain height for some reason. What does the min/max value of the raw mapped rrfac give you in the logs (see relevant code block below) ? If it seems like it's the values of terrain height, then maybe it's not reading in rrfac from the SCRIP file correctly in
|
When interpolating to grids that with 3 km grid spacing, the topo tool produces a height field which is significantly lower resolution than what is expected. I belive this is caused by the double interpolation from the ~1 km GMTED2010 data to the 3 km cube sphere then to the target grid. Then, with ridge analysis the height field is smoothed even further.
Below are two plots of the height field over conus. The first, is the x5.6488066.grid.nc (15-3 km variable resolution mesh) with the 3 km refinement centered over CONUS with the height field that was created with this tool. (I believe the height field outside of the continent lines is due to a lack of landmask).
The second is GMTED2010 dataset interpolated to the x1.65536002.grid.nc (3 km quasi-uniform grid) gird using the MPAS-Model`s init_atmosphere core.
These files can be found on glade at:
/glade/scratch/mcurry/cam-mpas-topo-compare
Is there a way interpolate GMTED2010 to a higher resolution cube sphere?
The text was updated successfully, but these errors were encountered: