[gdal-dev] Questions on working with HYCOM data in netcdf format

Stephen Woodbridge woodbri at swoodbridge.com
Mon Jun 6 18:23:30 PDT 2016


Kurt, Even,

Progress! Check this out:

http://imaptools.com:8080/demo/tiger-hycom.html?zoom=8&lat=31.42299&lon=-79.78765&layers=BTT

I tweaked your script, to copy both the water_u and water_v as separate 
bands (so back to 80 bands), I actually only need a few depths so 
eventually I'll cut that down.

If you zoom out there are lots of blank areas with no currents. I'm not 
sure if this is normal or what.

https://gist.github.com/woodbri/ad0984675b17c45739dbb592bde6639a#file-hycom_uv_netcdf_to_uv_gtiff-py

Here are the mapfile bits:

https://gist.github.com/woodbri/ad0984675b17c45739dbb592bde6639a#file-mapfile-for-hycom-ocean-currents-map

Thanks for the help!

-Steve

On 6/6/2016 2:29 PM, Stephen Woodbridge wrote:
> On 6/6/2016 1:25 PM, Kurt Schwehr wrote:
>> +gdal-dev
>>
>> Some hackish test code I had laying around from last year...
>>
>> https://gist.github.com/schwehr/01f6604afc7757ea0a676f0eb28be582
>>
>
> Thank you! I have it running, so next I'll play with the code.
>
>> You might also be able to just write 80 layers of u-v, pick out pairs
>> for each depth layer and have the rendering system do the
>> conversion(s).  You could use whatever you want once you have a
>> geotiff.  In this screenshot, I made an 80-layer geotiff of u and v
>> alternating layers and uploaded that to Earth Engine.  It's been a long
>> time since I heavily used mapserver, but you could probably do the same
>> there.
>>
>> https://www.flickr.com/photos/schwehr/26895009754/
>
> Very cool picture!
>
> This really helps to get me started.
>
> Thanks,
>   -Steve
>
>> On Mon, Jun 6, 2016 at 7:51 AM, Stephen Woodbridge
>> <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>> wrote:
>>
>>     On 6/5/2016 2:04 PM, Kurt Schwehr wrote:
>>
>>         Stephen,
>>
>>         Take a look at these two discussions for starters on working
>>         with hycom:
>>
>>
>> http://gis.stackexchange.com/questions/167155/how-can-i-make-geotiffs-of-individual-depth-layers-in-the-hycom-ocean-circulatio
>>
>>
>>
>>     Hi Kurt,
>>
>>     In the link above you mention:
>>
>>         I've got some code written the does things like calculate the
>> speed
>>         inm/s from the UV and creates a geotiff, etc
>>
>>
>>     Can you share this code, it sounds like exactly what I need for the
>>     current vectors? And I'm interested in figuring out how to
>>     read/write and work with the netcdf files.
>>
>>     I think for now I'll work with the "u" datasets as they seem that
>>     they will be much easier place to start.
>>
>>     Thanks,
>>       -Steve
>>
>>
>>
>> http://gis.stackexchange.com/questions/170882/how-can-a-make-a-netcdf-with-subgroups-smaller
>>
>>
>>         You should start with the regular grids.  e.g.
>>
>>
>> ftp://ftp.hycom.org/datasets/GLBu0.08/expt_91.1/data/hindcasts/2015/hycom_glb_911_2015093000_t000_uv3z.nc
>>
>>
>>         Make an 80 layer geotiff from the u/v and then use mapserver
>> as Even
>>         suggested.
>>
>>         -kurt
>>
>>
>>         On Sat, Jun 4, 2016 at 6:29 AM, Even Rouault
>>         <even.rouault at spatialys.com <mailto:even.rouault at spatialys.com>
>>         <mailto:even.rouault at spatialys.com
>>         <mailto:even.rouault at spatialys.com>>> wrote:
>>
>>             Hi,
>>             >
>>             > I want to convert some HYCOM data into GTiff format and
>>         I'm a little
>>             > lost on how to get started, whether I can do what I need
>>         just using a
>>             > vrt or if I'm going to have to write code to process the
>> data.
>>             >
>>             > To start with I have placed gdalinfo on one file here:
>>             > http://imaptools.com:8080/dl/hycom-gdalinfo.txt
>>             >
>>             > The data comes from
>> http://hycom.org/dataserver/glb-analysis
>>             > and I will need to be using GLBa0.08 dataset.
>>             >
>>             > I have two use cases:
>>             >
>>             > 1) The simple one is to extract say Band 1 into a
>>         georeferenced GTiff
>>             > and apply color to using color ranges without loosing the
>>         NODATA. I
>>             > think I can do later using .vrt, correct?
>>
>>             gdaldem color-relief can output to a VRT, but given that
>>         this netCDF
>>             file is
>>             georeferenced through a geolocation array, you'll likely
>>         have first
>>             to run
>>             gdalwarp -geoloc to have something useful at the end.
>>
>>             >
>>             > I'm not sure how to deal with the georeferencing, because
>>         the download
>>             > site says: "Native hycom .[ab] data converted to NetCDF on
>>         native
>>             > Mercator-curvilinear HYCOM horizontal grid" but that does
>>         not seem in
>>             > sync with the Metadata in the file.
>>             >
>>             > 2) The more complicated case is that there are two files:
>>             >     a)  eastward_sea_water_velocity (aka: u, u-velocity)
>>             >     b)  northward_sea_water_velocity (aka: v, v-velocity)
>>             > that I would like to use to create a grid of vectors with
>>         arrowheads
>>             > using u and v to define the vector and where the color of
>>         the vector is
>>             > related to the magnitude of its length. Ultimately this
>>         data will get
>>             > rendered via mapserver so I'm wondering if I can do this
>>         via a GTiff or
>>             > if I will have to resort to creating a massive point
>>         shapefile with
>>             > attributes of angle and magnitude and use a symbol. It
>>         seems like it
>>             > would be best if I can keep the data as a GTiff and then
>>         sample the
>>             > points and render the vectors on the fly for when you zoom
>>         in/out.
>>
>>             See
>>             http://mapserver.org/input/vector/vector_field.html
>>
>>             You don't need to create a vector file.
>>
>>             You'll have to preprocess your file to get the u and v bands
>>         in the same
>>             raster.
>>
>>             Even
>>
>>             --
>>             Spatialys - Geospatial professional services
>>             http://www.spatialys.com
>>             _______________________________________________
>>             gdal-dev mailing list
>>             gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>>         <mailto:gdal-dev at lists.osgeo.org
>> <mailto:gdal-dev at lists.osgeo.org>>
>>             http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>>
>>
>>
>>         --
>>         --
>>         http://schwehr.org
>>
>>
>>
>>     ---
>>     This email has been checked for viruses by Avast antivirus software.
>>     https://www.avast.com/antivirus
>>
>>
>>
>>
>> --
>> --
>> http://schwehr.org
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the gdal-dev mailing list