This page demonstrates Python tips and tricks that I use in my everyday programming as an atmospheric science graduate student.
-Brian Blaylock

Monday, May 23, 2016

Edit netCDF files with Photoshop

http://home.chpc.utah.edu/~u0553130/Brian_Blaylock/lake_surgery.html#PHOTO

I always thought it would be nice if I could load a netCDF file into photoshop and make changes to fields with the paint brush and pencil tool.
Well, now you can, with this three step process using Python (this only works with landuse or categorical data sets so far).
This is a work in progress and will get more attention after I defend my thesis, but it's a really handy concept.
  1. Convert a netCDF array into a bitmap image netcdf_to_bitmap.py.
  2. Open image in PhotoShop and use the pencil tool to change colors (i.e. land use categories). Save image as bitmap.
  3. Open the modified land use image in Python bitmap_to_netcdf.py. and extract the colors as categories. Save array into the WRF netCDF file

Below you can see that I added more lake and urban area using the pencil tool to the WRF landuse array.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.