-
Notifications
You must be signed in to change notification settings - Fork 108
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
Define constants in chgres_cube.fd/search_util.f90 #448
Changes from 6 commits
222a8b1
ef05f86
ddca6cf
3650b29
e130123
9d85f8a
bdc9a0c
6fc47ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,27 +215,47 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude, terrain_l | |
|
||
end subroutine search | ||
|
||
!> Set sst values based on latitude. | ||
!> Set default sst values based on latitude. | ||
!! | ||
!! @param latitude latitude input | ||
!! @param sst sst guess value to be set | ||
!! Based loosely on the average annual SST | ||
!! values from ./fix_am/cfs_oi2sst1x1monclim19822001.grb | ||
!! | ||
!! The temperature in the polar and tropical regions | ||
!! is set to 273.16/300 Kelvin. Polar regions are | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean it is set to 273.16 in polar regions and 300 in tropical? If so, please say so more clearly. If not, add even more clarity to this sentence. ;-) |
||
!! poleward of 60 degrees. Tropical regions are within | ||
!! 30 degrees of the equator. In mid-latitudes, a | ||
!! linear change with latitude is used. | ||
!! | ||
!! @param [in] latitude Latitude in degrees | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for adding units! ;-) Always a good idea!! Is this degrees and minutes or degrees and hundredths? |
||
!! @param [out] sst Default SST in Kelvin | ||
!! @author George Gayno NCEP/EMC | ||
subroutine sst_guess(latitude, sst) | ||
|
||
use esmf | ||
|
||
implicit none | ||
|
||
real(esmf_kind_r8), parameter :: sst_polar_in_kelvin = 273.16 !< Default SST in polar | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The usual convention is to name parameter variables in all caps, for example SST_POLAR_IN_KELVIN. Of course since fortran ignores case anyway, this is purely a convention, and not a perfect one. However, it does help make clear in the code what part of a formula is a constant and what parts are variables. |
||
!! regions. | ||
real(esmf_kind_r8), parameter :: sst_tropical_in_kelvin = 300.0 !< Default SST in | ||
!! tropical regions. | ||
real(esmf_kind_r8), parameter :: polar_latitude = 60.0 !< Latitude in degrees defining polar regions. | ||
real(esmf_kind_r8), parameter :: tropical_latitude = 30.0 !< Latitude in degrees defining tropical regions. | ||
real(esmf_kind_r8), parameter :: dsst_dlat = -0.8947 !< Change in SST per latitude in | ||
!! mid-latitudes. | ||
real(esmf_kind_r8), parameter :: sst_y_intercept = 326.84 !< y intercept for the linear | ||
!! change of SST in mid-latitudes. | ||
|
||
real(esmf_kind_r8), intent(in) :: latitude | ||
|
||
real(esmf_kind_r8), intent(out) :: sst | ||
|
||
if (abs(latitude) >= 60.0) then | ||
sst = 273.16 | ||
elseif (abs(latitude) <= 30.0) then | ||
sst = 300.0 | ||
if (abs(latitude) >= polar_latitude) then | ||
sst = sst_polar_in_kelvin | ||
elseif (abs(latitude) <= tropical_latitude) then | ||
sst = sst_tropical_in_kelvin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, this is a vast improvement in code readability! |
||
else | ||
sst = (-0.8947) * abs(latitude) + 326.84 | ||
sst = dsst_dlat * abs(latitude) + sst_y_intercept | ||
endif | ||
|
||
end subroutine sst_guess | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using SST as an acronym, please capitalize it for clarity.
Also, the first time using an acronym in a documentation block (i.e. the first sentence in this case), define it:
Set default Sea Surface Temperatures (SST) values based on latitude.