JCSDA-internal / ioda-converters

Various converters for getting obs data in and out of IODA
9 stars 5 forks source link

Fix wrong lat/lon for afwa snowDepth converter when stereographic projection is used #421

Closed YoulongXia-NOAA closed 3 years ago

YoulongXia-NOAA commented 3 years ago

Description

Need to modify the converter python codes using pyproj to calculate lat/lon when North/South polar stereographic projection parameters are used. For test cases with small region data, this issue is not found. However, the users found this bug when the converters are used for northern/southern hemisphere AFWA grib1 data file and IMS grib2 data file to ask me to fix.

Requirements

This bug will be fixed to output the correct latitudes and longitudes.

Acceptance Criteria (Definition of Done)

The python codes will be modified to pass ctest, commit to a feature branch and finally the modified codes will be merged into development branch.

Dependencies

No

YoulongXia-NOAA commented 3 years ago

data = pygrib.open(filename) lat, lon= data[1].latlons()

These two sentences cannot read the correct geographic latitudes and longitudes when north/south polar stereographic projection is used for grib file. It needs to calculate x and y and use pyproj to convert the correct lat/lon values.

barlage commented 3 years ago

@YoulongXia-NOAA to be clear, the issue does exist in the subset, it is just not noticeable, i.e., doesn't have obviously incorrect latitudes.

YoulongXia-NOAA commented 3 years ago

Yes for test cases as the input file used is via COPYGB to extract small region data from north hemisphere afwa data file.

YoulongXia-NOAA commented 3 years ago

COPYGB also uses to cut small region for IMS snow cover. Therefore, for these two test cases, the codes work reasonably. However, when the original hemisphere file is used, the codes seem to have problems.

YoulongXia-NOAA commented 3 years ago

I have checked that IMS snow cover converter works well when northern hemisphere grib2 file is read. Its python code does not need to be modified. Some minor revisions, e.g., adding unit % and changing "snow_cover_fraction" into "snowCoverFraction" based on Greg Thomson's document rule, will be done.

YoulongXia-NOAA commented 3 years ago

Modified ims_scf2ioda.py by adding unit %.

YoulongXia-NOAA commented 3 years ago

When the code uses pygrib to read afwa snow depth data, for south polar stereographic projection, Lat of True Origin(lat_ts) is 60 rather than -60. Therefore python code needs to reset this value as -60. Additionally, the initial x is positive value rather than negative value as read in other standard grib1/grib2 file, so that the code uses x = llcrnrx - dx*np.arange(nx) to calculate x location. After these modifications, this issue is solved.

YoulongXia-NOAA commented 3 years ago

Based on CPC and EMC scientists' experience in use of AFWA snow depth for CFS or using grads for make plots for monitoring purpose. The approach is that first change orientation angle from 100 to -80 so that COPYGB and gribctl can work. After COPYGB processing, both grads and pygrib work reasonably. The reason remains unclear if AFWA snow depth grib1 file is not standard or if pygrib can handle such a grib1 file. In present, this fix can be considered as an intermediate solution.