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
Transverse Mercator section added in cf writer #920
Conversation
Transverse Mercator section added in cf writer
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.
@bornagain1981 Thank you very much for adding the transverse mercator to the cf writer! The modifications look good, good job. Just a couple of things:
- could you fix the style error flagged by Stickler CI ?
- and could you add a simple test like this one : https://github.com/pytroll/satpy/blob/master/satpy/tests/writer_tests/test_cf.py#L680-L715 ?
Codecov Report
@@ Coverage Diff @@
## master #920 +/- ##
=========================================
+ Coverage 86.86% 87.37% +0.5%
=========================================
Files 181 183 +2
Lines 27461 28179 +718
=========================================
+ Hits 23853 24620 +767
+ Misses 3608 3559 -49
Continue to review full report at Codecov.
|
@mraspaud during test : 2 errors and some warnings (i receive the same during the test cf writer in branch master) (pytroll) bornagain@bornlaptop:~/satpy/satpy$ python3 tests/writer_tests/test_cf.py FAIL: test_da2cf (main.TestCFWriter) Traceback (most recent call last): FAIL: test_encode_attrs_nc (main.TestCFWriter) Traceback (most recent call last): Ran 20 tests in 0.402s FAILED (failures=2) |
@bornagain1981 ok, do you still have the errors with master ? the warnings are ok I think |
yes, same error using branch-master, different computers or launching test in another conda environment |
Test_cf is ok and passed also the other test: """Test the conversion from pyresample area object to CF grid mapping."""
import xarray as xr
import pyresample.geometry
from satpy.writers.cf_writer import area2gridmapping
def assertEqual(var1, var2):
if var1 == var2:
return True
else:
return False
ds_base = xr.DataArray(data=[[1, 2], [3, 4]], dims=('y', 'x'), coords={'y': [1, 2], 'x': [3, 4]},
attrs={'name': 'var1'})
# a) Projection has a corresponding CF representation (e.g. geos)
lat_0= 36.5
lon_0= 15.0
lat_ts= 36.5
tmerc = pyresample.geometry.AreaDefinition(
area_id='tmerc',
description='tmerc',
proj_id='tmerc',
projection={'proj': 'tmerc', 'ellps': 'WGS84', 'lat_0': 36.5, 'lon_0': 15.0,'lat_ts': 36.5},
width=2, height=2,
area_extent=[-1, -1, 1, 1])
tmerc_expected = xr.DataArray(data=0,
attrs={'azimuth_of_central_line':'alpha',
'latitude_of_projection_origin':lat_0,
'longitude_of_projection_origin':lon_0,
'latitude_of_meridian_ts':lat_ts,
'grid_mapping_name':'transverse_mercator',
'reference_ellipsoid_name':('ellps', 'WGS84'),
'prime_meridian_name':('pm', 'Greenwich'),
'horizontal_datum_name':('datum', 'unknown'),
'geographic_crs_name':'unknown',
'false_easting':0.,
'false_northing':0.,
'name': 'tmerc'})
ds = ds_base.copy()
ds.attrs['area'] = tmerc
res, grid_mapping = area2gridmapping(ds) assertEqual(grid_mapping, tmerc_expected)
assertEqual(res.attrs['grid_mapping'], 'tmerc')
|
Nice work @bornagain1981 ! I think you just need to add your name to the AUTHORS.md file, the rest looks fine |
flake8 satpy
AUTHORS.md
if not there already