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

Issue523 s1l2 mapper #524

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Issue523 s1l2 mapper #524

wants to merge 3 commits into from

Conversation

korvinos
Copy link
Member

New mapper for s1 iw l2 data with the support of the owi and rvl products

Copy link
Member

@akorosov akorosov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix two things: key word args explicitly in the init defintion and context manager for Dataset() ?

class Mapper(VRT):
""""""

def __init__(self, file_src, gdal_dataset, gdal_metadata, *args, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def __init__(self, file_src, gdal_dataset, gdal_metadata, *args, **kwargs):
def __init__(self, file_src, gdal_dataset, gdal_metadata, subswath_id=0, product='rvl', dop_time = False, **kwargs):

Like in : https://github.com/nansencenter/nansat/blob/master/nansat/mappers/mapper_sentinel1_l1.py

Comment on lines +35 to +50
# Check if the subswath number [1, 2, 3] is provided
# Subswath number is required for mapping the RVL products
if 'subswath_n' in kwargs.keys():
subswath_id = kwargs['subswath_n'] - 1
else:
subswath_id = 0
# Check if the product type is provided: rvl
if 'product_type' in kwargs.keys():
product = kwargs['product_type']
else:
product = 'rvl'

if 'dop_time' in kwargs.keys():
dop_time = kwargs['dop_time']
else:
dop_time = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Check if the subswath number [1, 2, 3] is provided
# Subswath number is required for mapping the RVL products
if 'subswath_n' in kwargs.keys():
subswath_id = kwargs['subswath_n'] - 1
else:
subswath_id = 0
# Check if the product type is provided: rvl
if 'product_type' in kwargs.keys():
product = kwargs['product_type']
else:
product = 'rvl'
if 'dop_time' in kwargs.keys():
dop_time = kwargs['dop_time']
else:
dop_time = False

else:
dop_time = False
# Read the NetCDF dataset
nc_dataset = Dataset(file_src)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If something goes wrong nc is not closed -potential memory leak.
Its is better to always use

with Dataset(file_src) as nc_dataset:
    all_the_data = nc_dataset['all_the_data']

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

Successfully merging this pull request may close these issues.

2 participants