Commit b457fdf9 authored by ARCHER's avatar ARCHER 💬
Browse files

crs_out as option + fix in final product

parent f2d7ba78
...@@ -19,13 +19,12 @@ else: ...@@ -19,13 +19,12 @@ else:
if __name__ == "__main__": if __name__ == "__main__":
description = """Converts nclight file to gridded nc format""" description = """Converts nclight file to gridded nc format"""
parser = argparse.ArgumentParser(description = description) parser = argparse.ArgumentParser(description = description)
parser.add_argument('--crs',action="store",default=None,help="destination crs as proj4, ie 'epsg:4326'. If None, aeqd will be used")
parser.add_argument('infile') parser.add_argument('infile')
parser.add_argument('outfile') parser.add_argument('outfile')
args = parser.parse_args() args = parser.parse_args()
logger.info('%s -> %s' % (args.infile,args.outfile)) logger.info('%s -> %s' % (args.infile,args.outfile))
crs_out = "epsg:4326" owi.nclight2gridded(args.infile,args.outfile,crs_out= args.crs)
#crs_out = None
owi.nclight2gridded(args.infile,args.outfile,crs_out= crs_out)
# gdaldem color-relief NETCDF:"/tmp/test_gd.nc":wind_speed wind_speed.txt /tmp/testowi1.tif -alpha # gdaldem color-relief NETCDF:"/tmp/test_gd.nc":wind_speed wind_speed.txt /tmp/testowi1.tif -alpha
# gdal_translate -of GTiff NETCDF:"/tmp/test_gd.nc":wind_speed /tmp/testowi.tif # gdal_translate -of GTiff NETCDF:"/tmp/test_gd.nc":wind_speed /tmp/testowi.tif
...@@ -445,7 +445,7 @@ def nclight2gridded(filein,fileout,crs_out=None): ...@@ -445,7 +445,7 @@ def nclight2gridded(filein,fileout,crs_out=None):
} }
encoding = {'lat': {'_FillValue': None}, 'lon': {'_FillValue': None}} encoding = {'lat': {'_FillValue': None}, 'lon': {'_FillValue': None}}
ds_gd.rio.set_spatial_dims('lon','lat', inplace=True) ds_gd.rio.set_spatial_dims('lon','lat', inplace=True)
ds_gd.rio.write_crs(crs, inplace=True) ds_gd.rio.write_crs(crs_out, inplace=True)
ds_gd.to_netcdf(fileout,encoding=encoding,format='NETCDF4_CLASSIC') ds_gd.to_netcdf(fileout,encoding=encoding,format='NETCDF4_CLASSIC')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment