inverted mask
inverted mask
I am trying to generate a grid using pyroms but I keep getting the mask inverted
I've been using pyroms to generate grids North Caribean region without any problem,
any ideas of what could be wrong?
thanks in advance
Luis Sorinas
I've been using pyroms to generate grids North Caribean region without any problem,
any ideas of what could be wrong?
thanks in advance
Luis Sorinas
- Attachments
-
- cepa_grid.png (142.65 KiB) Viewed 9457 times
Re: inverted mask
Yeah, I had that happen once too. Another way to set the land mask is with this package. He only sets the mask_rho variable so you need to set the u/v masks to be consistent with them - one way to do that is to fire up one of the editmask tools and let it do that.
Re: inverted mask
thanks a lot Kate, it seems like a great tool
I will try it
I have another pyroms question, perhaps is more about opendap
I am tying to use pyroms to download hycoms ncoda 1/12 data base on the Palau Exmple script, perhaps my question is silly but I cannot find in Hycoms data server a link to the data that pyroms understand
for example
in your Palau Hycom get_hycom_GLBa0.08_Palau_grid.py you donwload data from
http://tds.hycom.org/thredds/dodsC/data ... _00_3zt.nc
but when I try to download it thi is the link I get from hycom data server
http://tds.hycom.org/thredds/dodsC/GLBa ... temp?Depth[0:1:32]
where can I ind data that en in something like archv.2015_001_00_3zt.nc
regards
Luis
I will try it
I have another pyroms question, perhaps is more about opendap
I am tying to use pyroms to download hycoms ncoda 1/12 data base on the Palau Exmple script, perhaps my question is silly but I cannot find in Hycoms data server a link to the data that pyroms understand
for example
in your Palau Hycom get_hycom_GLBa0.08_Palau_grid.py you donwload data from
http://tds.hycom.org/thredds/dodsC/data ... _00_3zt.nc
but when I try to download it thi is the link I get from hycom data server
http://tds.hycom.org/thredds/dodsC/GLBa ... temp?Depth[0:1:32]
where can I ind data that en in something like archv.2015_001_00_3zt.nc
regards
Luis
Re: inverted mask
Weird, the HYCOM tab in my browser points to http://tds.hycom.org/thredds/dodsC/data ... talog.html which now gives an error. Obviously it was working earlier this year. Anyone know where to look for it now?
-
- Posts: 7
- Joined: Mon Dec 05, 2011 3:29 pm
- Location: Instituto de oceanolodia(IDO)
Re: inverted mask
Hi
About the inverted mask, i think i have a solution or at least it work for me.
Instead of using map.coastsegs for the polygons i use map.coastpolygons, something like this:
for xx,yy in map.coastpolygons:
xa = np.array(xx, np.float32)
ya = np.array(yy,np.float32)
vv = np.zeros((xa.shape[0],2))
vv[:, 0] = xa
vv[:, 1] = ya
hgrd.mask_polygon(vv,mask_value=0)
About the inverted mask, i think i have a solution or at least it work for me.
Instead of using map.coastsegs for the polygons i use map.coastpolygons, something like this:
for xx,yy in map.coastpolygons:
xa = np.array(xx, np.float32)
ya = np.array(yy,np.float32)
vv = np.zeros((xa.shape[0],2))
vv[:, 0] = xa
vv[:, 1] = ya
hgrd.mask_polygon(vv,mask_value=0)
Re: inverted mask
Cool, thanks!
Re: inverted mask
I am guessing that the source of this, is in the way the code 'jumps' from an open coast segment to the next.
When a shoreline is interrupted by the Basemap function, the topology changes and so does the distinction between land and water.
When I ran into a similar situation, I solved it by declaring the initial Basemap function without borders (i.e. the whole world - no lonmax, latmax etc.):
In this way pygridgen gets all the topological information of where land stops.
Stamatis
When a shoreline is interrupted by the Basemap function, the topology changes and so does the distinction between land and water.
When I ran into a similar situation, I solved it by declaring the initial Basemap function without borders (i.e. the whole world - no lonmax, latmax etc.):
Code: Select all
map = Basemap(projection='merc',resolution='i')
Stamatis
Re: inverted mask
Hi, Luis and Kate, have you solved the problem about url?
Several days ago, I have successed downloading some data from the url like http://tds.hycom.org/thredds/dodsC/data ... _00_3zs.nc. However, when I use the same script to download data today,it gives me the message:
It means the opendap url is inaccessible, right? Do you have any suggestions for me?
Thank you very much.
Several days ago, I have successed downloading some data from the url like http://tds.hycom.org/thredds/dodsC/data ... _00_3zs.nc. However, when I use the same script to download data today,it gives me the message:
Code: Select all
syntax error, unexpected $end, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: ^
Traceback (most recent call last):
File "get_hycom_GLBa0.08_salt_2015.py", line 76, in <module>
dataset = netCDF4.Dataset(url)
File "netCDF4/_netCDF4.pyx", line 1848, in netCDF4._netCDF4.Dataset.__init__ (netCDF4/_netCDF4.c:13983)
OSError: NetCDF: Malformed or inaccessible DAP DDS
Thank you very much.
Re: inverted mask
I couldn't get files either a few weeks back. Perhaps they are having server issues. Why don't you contact the HYCOM people directly?
Re: inverted mask
Ok,thank you.