-
Notifications
You must be signed in to change notification settings - Fork 322
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
mkscripgrid.ncl generates corners in CW rather than CCW order #938
Comments
Shall I link this issue to #823 and resolve from there, or do you prefer that I open a new PR? |
Whichever is easier for you. |
From talking with Ufuk one resolution for this might be to remove the setting of corner coordinates. There was a problem in NCL in the past where they had to be set by hand. NCL probably does it correctly now so we could remove the manual setting of corners. |
The 5x5_amazon grid is in CCW order, so the original version must have been this way. The current version goes back to 2013 though. Applying the following difference I can reproduce the 5x5_amazon grid (with only a roundoff difference in center lat and lon). --- a/tools/mkmapgrids/mkscripgrid.ncl
+++ b/tools/mkmapgrids/mkscripgrid.ncl
@@ -124,16 +124,16 @@ end
do i = 0, nx-1
lat(:,i) = latCenters;
latCorners(:,i,0) = latCenters - delY/2.d0;
- latCorners(:,i,1) = latCenters + delY/2.d0;
+ latCorners(:,i,1) = latCenters - delY/2.d0;
latCorners(:,i,2) = latCenters + delY/2.d0;
- latCorners(:,i,3) = latCenters - delY/2.d0;
+ latCorners(:,i,3) = latCenters + delY/2.d0;
end do
do j = 0, ny-1
lon(j,:) = lonCenters;
lonCorners(j,:,0) = lonCenters - delX/2.d0;
- lonCorners(j,:,1) = lonCenters - delX/2.d0;
+ lonCorners(j,:,1) = lonCenters + delX/2.d0;
lonCorners(j,:,2) = lonCenters + delX/2.d0;
- lonCorners(j,:,3) = lonCenters + delX/2.d0;
+ lonCorners(j,:,3) = lonCenters - delX/2.d0;
end do
; for some reason, "No_FillValue" isn't working in the case where imask=1 Here's the command to use to reconstruct it...
|
Note, that if I let NCL set the corners, I also reproduce the 5x5_amazon grid, except only the corner latitudes are off by roundoff. So we might as well take out the calculation of the corners. |
The one thing about removing the calculation of the corners, is that it then doesn't work for a single point grid (or a grid with a single latitude or longitude). |
…CL to calculate corners for other cases
Brief summary of bug
It looks like https://github.com/ESCOMP/CTSM/blob/master/tools/mkmapgrids/mkscripgrid.ncl generates corners in clockwise rather than counter-clockwise order. According to ESMF documentation it is a requirement that corners be in counter-clockwise order.
General bug information
CTSM version you are using: master
Does this bug cause significantly incorrect results in the model's science? Probably not
Configurations affected: N/A
Details of bug
Both from examining the code and from running NCL's scrip_check_input on a generated grid, it appears that corners are in the wrong order. I'm not sure whether this actually causes problems with the generated mapping files.
The text was updated successfully, but these errors were encountered: