@@ -258,7 +258,7 @@ def fetch_swot_raster(
258258 end : str = typer .Option (..., "--end" , help = "End date (YYYY-MM-DD)." ),
259259 aoi_name : str = typer .Option ("aoi" , "--aoi-name" , help = "Label for the AOI." ),
260260 product : str = typer .Option (
261- "SWOT_L2_HR_PIXC_D " , "--product" , help = "SWOT raster product short name."
261+ "SWOT_L2_HR_PIXC_2.0 " , "--product" , help = "SWOT raster product short name."
262262 ),
263263 output : str = typer .Option (
264264 "hydroeo_output" , "--output" , "-o" , help = "Output directory (created if absent)."
@@ -300,6 +300,99 @@ def fetch_swot_raster(
300300 typer .echo (f"SWOT raster download complete. Output: { output } " )
301301
302302
303+ # ---------------------------------------------------------------------------
304+ # fetch swot-pixc
305+ # ---------------------------------------------------------------------------
306+
307+
308+ @fetch_app .command ("swot-pixc" )
309+ def fetch_swot_pixc (
310+ bbox : str = typer .Option (
311+ ...,
312+ "--bbox" ,
313+ help = "Bounding box as a quoted string: 'MINLON MINLAT MAXLON MAXLAT'." ,
314+ ),
315+ start : str = typer .Option (..., "--start" , help = "Start date (YYYY-MM-DD)." ),
316+ end : str = typer .Option (..., "--end" , help = "End date (YYYY-MM-DD)." ),
317+ aoi_name : str = typer .Option ("aoi" , "--aoi-name" , help = "Label for the AOI." ),
318+ product : str = typer .Option (
319+ "SWOT_L2_HR_PIXC_D" , "--product" , help = "SWOT pixel cloud product short name."
320+ ),
321+ output : str = typer .Option (
322+ "hydroeo_output" , "--output" , "-o" , help = "Output directory (created if absent)."
323+ ),
324+ classes : Optional [str ] = typer .Option (
325+ None ,
326+ "--classes" ,
327+ help = "Comma-separated water classes to include (e.g., 'open_water,water_near_land'). "
328+ "Default: open_water,water_near_land." ,
329+ ),
330+ fields : Optional [str ] = typer .Option (
331+ None ,
332+ "--fields" ,
333+ help = "Comma-separated fields to grid (e.g., 'heightEGM,height'). Default: heightEGM." ,
334+ ),
335+ grid_resolution : int = typer .Option (
336+ 100 , "--grid-resolution" , help = "Grid resolution in meters. Default: 100."
337+ ),
338+ stat_method : str = typer .Option (
339+ "median" ,
340+ "--stat-method" ,
341+ help = "Binning statistic method (median, mean, min, max, count). Default: median." ,
342+ ),
343+ username : Optional [str ] = typer .Option (
344+ None , "--username" , help = "EarthAccess username (or set EARTHACCESS_USERNAME)."
345+ ),
346+ password : Optional [str ] = typer .Option (
347+ None ,
348+ "--password" ,
349+ help = "EarthAccess password (or set EARTHACCESS_PASSWORD)." ,
350+ hide_input = True ,
351+ ),
352+ verbose : bool = typer .Option (
353+ False , "--verbose" , "-v" , help = "Enable debug logging."
354+ ),
355+ ):
356+ """Download SWOT pixel cloud data, preprocess, and grid to rasters.
357+
358+ Point cloud data is filtered by water class, extracted with heightEGM computation,
359+ and gridded to regular GeoTIFF rasters using specified statistics.
360+ """
361+ _configure_logging (verbose )
362+ parsed_bbox = _parse_bbox (bbox )
363+ startdate = _parse_date (start , "--start" )
364+ enddate = _parse_date (end , "--end" )
365+ u , p = _resolve_earthaccess_creds (username , password )
366+
367+ # Parse optional classes and fields
368+ classes_list = (
369+ [c .strip () for c in classes .split ("," )]
370+ if classes
371+ else ["open_water" , "water_near_land" ]
372+ )
373+ fields_list = [f .strip () for f in fields .split ("," )] if fields else ["heightEGM" ]
374+
375+ config = {
376+ "aoi" : {
377+ "name" : aoi_name ,
378+ "type" : "bbox" ,
379+ "bbox" : parsed_bbox ,
380+ },
381+ "product" : product ,
382+ "startdate" : [startdate .year , startdate .month , startdate .day ],
383+ "enddate" : [enddate .year , enddate .month , enddate .day ],
384+ "classes" : classes_list ,
385+ "fields" : fields_list ,
386+ "grid_resolution" : grid_resolution ,
387+ "stat_method" : stat_method ,
388+ }
389+
390+ from HydroEO .satellites .swot .pixc import download_pixc
391+
392+ download_pixc (config = config , project_dir = output , credentials = (u , p ))
393+ typer .echo (f"SWOT pixel cloud download complete. Output: { output } " )
394+
395+
303396# ---------------------------------------------------------------------------
304397# fetch swot-lake
305398# ---------------------------------------------------------------------------
0 commit comments