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

Problems with Mercator Projection in MCIP #190

Open
ramespada opened this issue May 8, 2023 · 5 comments
Open

Problems with Mercator Projection in MCIP #190

ramespada opened this issue May 8, 2023 · 5 comments

Comments

@ramespada
Copy link

ramespada commented May 8, 2023

Hi,

I'm trying to run CMAQ with a grid in mercator projection.

I am preparing the input data and I have reprojected latlon (epsg:4326) data to my mercator projection with PROJ library.
Documentation/Users_Guide says I should use the following srs definition in order to reproject properly my data:
Mercator: "+proj=merc +a=6370000.0 +b=6370000.0 +lat_ts=$P_ALP +lon_0=$P_GAM"

With $P_ALP and $P_GAM given in the GRIDDESC file.

But when I do that it doesn't exactly match the grid generated by MCIP nor the grid of the wrfout file.

I have looked the code and I find two curious things:

(1) in ll2xy_merc.f90 it uses USE const, ONLY: rearth but in the const_mod.f90 rearth isn't defined. I dont know where it extracts the rearth.

(2) the ll2xy_merc (phi, lambda, lambda0, xx, yy) subroutine only only has lambda0 (center longitude [deg]) as projection argument, but in the documentation that I cited above i have $P_ALP and $P_GAM that represents the latitude of true scale and longitude of the central meridian respectively (according the ioapi documentation ).

Any help would be appreciated

I leave here mi griddesc file and the PROJ srs definition that I am trying to use:
GRIDDESC:

' '
'PAPILA'
  7         0.000         0.000       -61.000       -61.000         0.000
' '
'PAPILAGRID'
'PAPILA'  -3510000.000  -7631603.000     27000.000     27000.000  260  337    1
' '

SRS of Input Grids: epsg:4326
SRS of Output Grids: +proj=merc +lat_ts=0.000 +lon_0=-61.000 +a=6370000.0 +b=6370000.0 +units=m

@ramespada
Copy link
Author

Just to be clear: MCIP is doning its job well. But it is not clear what it is doing following the documentation and reading the code.

@ramespada
Copy link
Author

I solved (2), rearth is remplaced by "eradm" variable created in readnml.f90.

@ramespada
Copy link
Author

Hi,

I found the problem. MCIP didn't write on GRIDDESC the "truelat1" parameter that is important to define the projection. I have done the modification and sent a pull request.

Regards!

@kmfoley kmfoley reopened this May 11, 2023
@kmfoley
Copy link
Collaborator

kmfoley commented May 11, 2023

Hi @ramespada, we will leave your issue open until we have updated the code (following the discussion on your PR). This alerts other users that there is an issue. Thank you for your help!

@tlspero
Copy link
Contributor

tlspero commented Jun 6, 2023

Hi @ramespada! Thank you for bringing this limitation of MCIP to my attention. Indeed you are correct that MCIP is unnecessarily restricting the definitions of the Mercator projection domains to have a tangent latitude uniquely at the Equator. This is leftover from the restrictions in MM5, but WRF clearly allows deviation from this constraint. The solution you proposed in PR 191 (#191) is reasonable, but I will need to test it independently before I incorporate it into the CMAQ repo for the next major release (scheduled in 2024). Given my other priorities and balancing with the community's need for this fix, it will likely be several weeks before I can formally stage these mods for CMAQ. With your careful documentation here, I think other users in similar circumstances will benefit and can adjust their versions of MCIP accordingly until I can make the formal correction in the next release. I appreciate your details in explaining the error you encountered, as well as your diligence in proposing a workable solution. Thank you for your continued patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants