Question

Convert a netcdf with multiple variables into multiple xyz files

  • 21 March 2018
  • 2 replies
  • 34 views

I need to use an FMW script to extract xyz files from a single netcdf file. When using the data inspector, I see that the netcdf has several variables and multiple bands of data for each variable. Ultimately I am desiring the u and v datasets. I feel like I am close with my FMW file, but somehow it is not extracting the u and v datasets correctly.

My steps thus far are as follows:

1. Open FTP directory: ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/rtofs/prod/rtofs.YYYYMMDD/

(you need to adjust the date characters YYYYMMDD)

2. scroll to bottom and open the rtofs_glo_uv_YYYYMMDD_hcasts.nc.gz file

3. use gzip to uncompress the file: gzip -d rtofs_glo_uv_YYYYMMDD_hcasts.nc.gz

4. Open FME Workbench 2015 (I only have 2015 desktop)

5. Open FME script (attached here)

 

6. Provide input parameters:

SourceDataset = rtofs_glo_uv_YYYYMMDD_hcasts.nc (netcdf file that was downloaded above)

 

DestDataSet = C:\\

The expected output is to have a u_velocity and a v_velocity xyz file. Each file will have the following columns: lat, lon, band0

This is a very large dataset, so I use a clipper transformer to subset out the results - thus saving a lot of processing time. If there are better strategies to doing a subset, I am open to other ideas too.

Something about my script isnt properly traversing the netcdf structure properly to extract the lat, lon, u and v data. I appreciate any discussion or assistance with getting my script working.

Thanks,

Chris


2 replies

Userlevel 4

You may want to try using a RasterBandSeparator and a RasterCellCoercer before the PointCloudCombiner, but it will depend on your netcdf and how you want the result.

Userlevel 2
Badge +17

Hi @rip, I had a look at the netCDF dataset you have linked. It consists of four sub datasets (raster features) - Latitude, Longitude, u_velocity, and v_velocity. Latitude and Longitude rasters have a single band, the u_velocity and v_velocity rasters have nine bands for each.

This workflow converts the netCDF dataset to a table which has three columns - latitude, longitude and the first band of the u_velocity raster, with the PointCloud XYZ writer. If I understand your requirement correctly, this might help you. You can create v_velocity table with the same way, also extend it so that the table contains columns for multiple bands from u/v_velocity raster.

Component Mapping Parameter, Point Cloud XYZ Writer

Reply