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

If area units on source grid file are in sq deg, convert to sq radians #2022

Merged
merged 2 commits into from
Nov 3, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions tools/mapping/gen_mapping_files/runoff_to_ocn/src/map_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -644,13 +644,23 @@ SUBROUTINE map_gridRead(map, rfilename, ofilename, gridtype, lmake_rSCRIP)

rcode = nf_inq_varid (fid,'grid_imask',vid )
rcode = nf_get_var_int (fid,vid ,map%mask_a)

rcode = nf_inq_varid (fid,'grid_area',vid )
if (rcode.eq.0) then
rcode = nf_get_var_double(fid,vid ,map%area_a)
else
if (rcode.ne.0) then
write(6,*) "ERROR: could not find variable grid_area in source grid input file!"
stop
end if
rcode = nf_get_var_double(fid,vid ,map%area_a)
units = "" ! units needs to be emptied before reading from netCDF file
rcode = nf_get_att_text(fid, vid, "units", units)
if (trim(units).eq."square radians") then
! Nothing to do
else if (trim(units).eq."square degrees") then
map%area_a = map%area_a * DEGtoRAD * DEGtoRAD
else
write(6,*) "ERROR: Unrecognized units for source grid_area: ", trim(units)
stop
end if

map%frac_a = map%mask_a * 1.0_r8

Expand Down