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

update bin_to_cube tool #6294

Merged
merged 4 commits into from
May 31, 2024

Conversation

jsbamboo
Copy link
Contributor

@jsbamboo jsbamboo commented Mar 13, 2024

  1. modify ``bin_to_cube'' according to https://github.com/NCAR/Topo.git for cubed base topo generation
  2. read parameters from ``bin_to_cube.nl''

manually pin @mt5555

@mt5555
Copy link
Contributor

mt5555 commented Mar 13, 2024

@brhillman : The important change here is the normalization of terr_cube around line 286. That's a bug that E3SM introduced when we removed land_frac from this tool chain. This bug hasn't impacted us since it would only show up if someone made a new cube3000 file (or in this case, Jishi's cube12000 file).

Another change is the introduction of a namelist for input parameters - but this will break our existing workflow.
edit: actually, our existing tools probably start with the "cube3000", so maybe we dont have to worry about modifications to specifying inputs to bin_to_cube

@jsbamboo : there are still a lot of landfrac_* related variables in cube_to_bin, including writing it to the output file. Do we need this? I'm think it is no longer used by cube_to_target, so could be removed here as well.

@rljacob rljacob requested a review from mt5555 March 13, 2024 23:07
@rljacob rljacob added Atmosphere inputdata Changes affecting inputdata collection on blues labels Mar 13, 2024
@jsbamboo
Copy link
Contributor Author

@mt5555 I think you are right. we dont need landfrac* if ``lzero_out_ocean_point_phis'' is set to FALSE in cube_to_target, which is the default setting

please let me know if you want me to remove bin_to_cube.nl / other edits, or feel free to push commits on your end

@mt5555 mt5555 requested a review from whannah1 March 14, 2024 19:00
@mt5555
Copy link
Contributor

mt5555 commented Mar 14, 2024

In:
https://acme-climate.atlassian.net/wiki/spaces/DOC/pages/4189520033/800m+cubed+topo+generation+from+GMTED2010+15s+DEM

@jsbamboo reported that cube_to_target required 638G to run, with a 7.5 arch-second lat/lon input data set and cube12000 output.

Storing the landrac field on this grid is ~110GB. Thus removing it I think is worthwhile.

@jsbamboo
Copy link
Contributor Author

jsbamboo commented Mar 14, 2024

@mt5555: to clarify, the 638G memory would be needed from 7.5 arch-second lat/lon input (~250m) to cube48000 output (~200m), which is kind of pointless since it's more than the original resolution.. maybe processing to cube40000 (250 m) or cube24000 is appropriate, which would require ~75GB or 27GB for ``landfrac_cube'' (which is also big)

&binparams
raw_latlon_data_file = '/p/lustre2/zhang73/DATA/DEM/S5P_OPER_REF_DEM_15_00000000T000000_99999999T999999_20160111T104226.NCL_24-3.nc'
output_file = 'S5P_OPER_REF_DEM_15_24-3_cube12000.nc'
ncube=12000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure we want this to be the "default"?
Maybe it would be better to create a few different namelist files with the ncube value in the file name so it forces the user to make a decision on which resolution they need rather than blindly using whatever is set up in the single namelist file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These namelists are small enough we could just make them input (command line) arguments as well. I'd prefer that to namelists personally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it shouldn't be the default, i just picked the one for my test

please check the updates which use the command arguments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing something, but I don't see any changes where command line argument support was added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this nl had been deleted since 03/21 commits, and the command line arguments are put in bin_to_cube.F90:

  iargc = command_argument_count()
  if (iargc /= 3) then
      print *, "Usage: <executable> raw_latlon_data_file output_file ncube"
      stop
  end if

  call get_command_argument(1, raw_latlon_data_file)
  call get_command_argument(2, output_file)
  call get_command_argument(3, string_ncube)
  read(string_ncube, *) ncube

Comment on lines 170 to 178
!WRITE(*,*) "Adjustments to land fraction: Extend land fraction for Ross Ice shelf by"
!WRITE(*,*) "setting all landfractions south of 79S to 1"
!DO j=1,jm
! IF (lat(j)<-79.0) THEN
! DO i=1,im
! landfrac(i,j) = 1
! END DO
! END IF
!END DO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs an explanation for why it's commented out

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just remove it if we are not going to keep landfrac.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the updates all landfrac related content are removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's remove this code entirely.

Comment on lines 287 to 289
!+++ARH
landfrac_cube (i,j,k) = landfrac_cube (i,j,k)/weight(i,j,k)
!---ARH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove these "ARH" tags - they don't serve any purpose

STOP
ELSE
terr_cube (i,j,k) = terr_cube (i,j,k)/weight(i,j,k)
!+++ARH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd drop these signatures, they clutter up the code and don't add value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely drop these code tags, I can't stand clutter like this!

ELSE
terr_cube (i,j,k) = terr_cube (i,j,k)/weight(i,j,k)
!+++ARH
landfrac_cube (i,j,k) = landfrac_cube (i,j,k)/weight(i,j,k)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to keep landfrac around?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the updates, the second commit removed all landfrac related content

for my own experience so far landfrac is not needed so i vote to remove it, but it can be reverted if others want it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's drop it and then add it back if something breaks.

@jsbamboo
Copy link
Contributor Author

the second new commit removed landfrac, i pushed it for review while it can be reverted if anyone wants it

a RRM grid test for bin_to_cube and cube_to_target has passed for the updates, and there is no landfrac anymore in the outputs

@@ -856,9 +825,6 @@ program convterr

wt = weights_all(count,1)

if (lzero_out_ocean_point_phis.AND.landfrac_target(i).lt.0.01_r8) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of interesting, I hadn't noticed this before. This logical appears to set the new elevation to zero if landfrac is below a threshold value. Maybe this was the purpose for the landfrac variable in the original version. Do you see a problem with removing this? The hard-coded threshold seems kind of problematic because that would probably be resolution dependent.

Copy link
Contributor Author

@jsbamboo jsbamboo Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this flag is one of the reasons why the NCAR repo keeps the landfrac (NCAR/Topo#19)

i had no problem after removing ``lzero_out_ocean_point_phis'', and i've never enabled this flag before

@rljacob
Copy link
Member

rljacob commented Apr 12, 2024

@brhillman and @whannah1 have all your concerns been addressed?

@whannah1
Copy link
Contributor

@brhillman and @whannah1 have all your concerns been addressed?

No.

@jsbamboo
Copy link
Contributor Author

most of the latest comments were fixed by the 03/21 commits, but the last one to remove a comment has not yet. I am out of office since 04/05, I can push a commit after I get back to lab on ~04/21

@whannah1
Copy link
Contributor

@rljacob @brhillman I think the PR is ready to be merged.

@rljacob
Copy link
Member

rljacob commented May 2, 2024

@brhillman let me know if you don't have time for this.

@rljacob rljacob assigned rljacob and unassigned brhillman May 30, 2024
rljacob added a commit that referenced this pull request May 30, 2024
modify ``bin_to_cube'' according to https://github.com/NCAR/Topo.git for cubed base topo generation
read parameters from ``bin_to_cube.nl''
@rljacob
Copy link
Member

rljacob commented May 30, 2024

@mt5555 and @brhillman I've merged this to next. If you don't want it merged to master, let me know by tomorrow.

@mt5555
Copy link
Contributor

mt5555 commented May 31, 2024

great, thanks.

it will probably be a several more years before we next have to use this tool, but still good to resolve this PR.

@rljacob rljacob merged commit 24700a3 into E3SM-Project:master May 31, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Atmosphere inputdata Changes affecting inputdata collection on blues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants