Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature_3024_GRAD
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Dec 6, 2024
2 parents a6f7213 + 1b58927 commit 32591e0
Show file tree
Hide file tree
Showing 6 changed files with 639 additions and 329 deletions.
130 changes: 83 additions & 47 deletions docs/Users_Guide/masking.rst

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions internal/test_unit/xml/unit_gen_vx_mask.xml
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,27 @@
</output>
</test>

<!-- -->
<!-- SOLAR_TIME: Solar time -->
<!-- -->

<test name="gen_vx_mask_SOLAR_TIME">
<exec>&MET_BIN;/gen_vx_mask</exec>
<param> \
'G004' \
'20050808_12' \
&OUTPUT_DIR;/gen_vx_mask/SOLAR_MIDNIGHT_NH.nc \
-type solar_time,solar_alt,lat \
-thresh 'ge21||le3,le0,ge0' \
-intersection \
-name SOLAR_MIDNIGHT_NH \
-v 3
</param>
<output>
<grid_nc>&OUTPUT_DIR;/gen_vx_mask/SOLAR_MIDNIGHT_NH.nc</grid_nc>
</output>
</test>

<!-- -->
<!-- LAT: latitude band -->
<!-- -->
Expand Down Expand Up @@ -472,6 +493,27 @@
</output>
</test>

<!-- -->
<!-- DATA/DATA/LAT/LON: freezing western hemisphere land points -->
<!-- -->

<test name="gen_vx_mask_DATA_DATA_LAT_LON">
<exec>&MET_BIN;/gen_vx_mask</exec>
<param> \
&DATA_DIR_MODEL;/grib2/gfs/gfs_2012040900_F012.grib2 \
&DATA_DIR_MODEL;/grib2/gfs/gfs_2012040900_F012.grib2 \
&OUTPUT_DIR;/gen_vx_mask/DATA_DATA_LAT_LON_mask.nc \
-type data,data,lat,lon \
-mask_field 'name="LAND"; level="L0";' \
-mask_field 'name="TMP"; level="L0";' \
-thresh eq1,lt273,gt0,lt0 \
-intersection -v 5
</param>
<output>
<grid_nc>&OUTPUT_DIR;/gen_vx_mask/DATA_DATA_LAT_LON_mask.nc</grid_nc>
</output>
</test>

<!-- -->
<!-- SHAPE: shapefile masking -->
<!-- -->
Expand Down
43 changes: 43 additions & 0 deletions src/libcode/vx_solar/solar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,49 @@ return;
////////////////////////////////////////////////////////////////////////


double solar_time(unixtime gmt, double lon)

{

//
// right ascension and declination
//

double Ra;
double Dec;

solar_radec(gmt, Ra, Dec);

//
// local hour angle
//

double lha = gmt_to_gmst(gmt) - lon - Ra;

//
// rescale angle to -180 to 180
//

lha -= 360.0*floor((lha + 180.0)/360.0);

//
// rescale local hour angle to decimal hours of the solar day
//

double solar_hr = (lha + 180.0)/360.0 * 24;

//
// done
//

return solar_hr;

}


////////////////////////////////////////////////////////////////////////


void dh_to_aa(double lat, double Dec, double lha, double & alt, double & azi)

{
Expand Down
19 changes: 19 additions & 0 deletions src/libcode/vx_solar/solar.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,25 @@ extern void solar_altaz(unixtime gmt, double lat, double lon, double & alt, doub
////////////////////////////////////////////////////////////////////////


extern double solar_time(unixtime gmt, double lon);

//
// calculates the solar time for the given longitude.
//
//
// Input: gmt, greenwich mean time expressed as unix time
//
// lon, longitude (degrees) of given location (+ west, - east)
//
//
// Output: decimal hours f the solar day in range [0, 24),
// where 12 is solar noon
//


////////////////////////////////////////////////////////////////////////


extern void solar_radec(unixtime gmt, double & Ra, double & Dec);

//
Expand Down
Loading

0 comments on commit 32591e0

Please sign in to comment.