A :class:`wrf.WrfProj` subclass for Mercator projections. See Also: :class:`wrf.WrfProj`, :class:`wrf.LatLon`, :class:`wrf.PolarStereographic`, :class:`RotatedLatLon`, :class:`LambertConformal`
| 617 | |
| 618 | |
| 619 | class Mercator(WrfProj): |
| 620 | """A :class:`wrf.WrfProj` subclass for Mercator projections. |
| 621 | |
| 622 | See Also: |
| 623 | |
| 624 | :class:`wrf.WrfProj`, :class:`wrf.LatLon`, |
| 625 | :class:`wrf.PolarStereographic`, |
| 626 | :class:`RotatedLatLon`, :class:`LambertConformal` |
| 627 | |
| 628 | """ |
| 629 | def __init__(self, **proj_params): |
| 630 | """Initialize a :class:`wrf.Mercator` object. |
| 631 | |
| 632 | Args: |
| 633 | |
| 634 | **proj_params: Map projection optional keyword arguments, that |
| 635 | have the same names as found in WRF output NetCDF global |
| 636 | attributes: |
| 637 | |
| 638 | - 'TRUELAT1': True latitude 1. |
| 639 | - 'TRUELAT2': True latitude 2. |
| 640 | - 'MOAD_CEN_LAT': Mother of all domains center latitude. |
| 641 | - 'STAND_LON': Standard longitude. |
| 642 | - 'POLE_LAT': Pole latitude. |
| 643 | - 'POLE_LON': Pole longitude. |
| 644 | |
| 645 | """ |
| 646 | super(Mercator, self).__init__(**proj_params) |
| 647 | |
| 648 | self._lat_ts = ( |
| 649 | None if self.truelat1 == 0. or _ismissing(self.truelat1) |
| 650 | else self.truelat1) |
| 651 | |
| 652 | self._stand_lon = (0. if _ismissing(self.stand_lon, islat=False) |
| 653 | else self.stand_lon) |
| 654 | |
| 655 | def _cf_params(self): |
| 656 | _cf_params = {} |
| 657 | _cf_params["grid_mapping_name"] = "mercator" |
| 658 | _cf_params["longitude_of_projection_origin"] = self.stand_lon |
| 659 | _cf_params["standard_parallel"] = self.truelat1 |
| 660 | _cf_params["earth_radius"] = Constants.WRF_EARTH_RADIUS |
| 661 | |
| 662 | return _cf_params |
| 663 | |
| 664 | def _pyngl(self, geobounds, **kwargs): |
| 665 | if not pyngl_enabled(): |
| 666 | return None |
| 667 | |
| 668 | _pyngl = Resources() |
| 669 | _pyngl.mpProjection = "Mercator" |
| 670 | _pyngl.mpDataBaseVersion = "MediumRes" |
| 671 | _pyngl.mpCenterLatF = 0.0 |
| 672 | _pyngl.mpCenterLonF = self._stand_lon |
| 673 | |
| 674 | _pyngl.mpLimitMode = "Corners" |
| 675 | _pyngl.mpLeftCornerLonF = geobounds.bottom_left.lon |
| 676 | _pyngl.mpLeftCornerLatF = geobounds.bottom_left.lat |