Create a NetCDF file with data masked to retain land points only

前端 未结 2 1409
无人共我
无人共我 2021-01-15 19:57

I have masked a NetCDF file using basemap.gs script in grads. Here is what I got using the mask:

So, I would like to obtain a NetCDF file which

2条回答
  •  不思量自难忘°
    2021-01-15 20:28

    Since you already have the non-continental values masked out, the process is actually fairly simple. There is a command called "sdfwrite" which can write and variable defined in grads to file. The code would go something like this:

    define data = 
    set sdfwrite out.nc
    sdfwrite data
    

    *Make sure you remove the angle brackets; those were just for show

    Entering these into grads will 1) allocate memory to save the displayed data in the variable "data" 2) set the name of the output file to "out.nc" (you can of course change this to whatever you like), and 3) writes the information in the variable "data" to the out.nc file.

    Now as far as I know, there is no way to simply not have the masked out values not be written to file, but with this, they will all be written in as zero/undefined values.

    sdfwrite documentation

    Hope this Helps!!

提交回复
热议问题